summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/zend_compile.c7
-rw-r--r--ext/mbstring/mbstring.c2
-rw-r--r--ext/opcache/Optimizer/scdf.c3
-rw-r--r--ext/opcache/Optimizer/zend_ssa.c2
-rw-r--r--ext/pdo/pdo_stmt.c2
-rw-r--r--ext/sqlite3/sqlite3.c14
-rw-r--r--ext/standard/streamsfuncs.c4
-rw-r--r--ext/standard/string.c13
8 files changed, 24 insertions, 23 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 83bd649bb9..04a867a48a 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -4732,7 +4732,7 @@ void zend_compile_switch(zend_ast *ast) /* {{{ */
znode expr_node, case_node;
zend_op *opline;
- uint32_t *jmpnz_opnums, opnum_default_jmp, opnum_switch;
+ uint32_t *jmpnz_opnums, opnum_default_jmp, opnum_switch = (uint32_t)-1;
zend_uchar jumptable_type;
HashTable *jumptable = NULL;
@@ -4825,6 +4825,7 @@ void zend_compile_switch(zend_ast *ast) /* {{{ */
zend_update_jump_target_to_next(opnum_default_jmp);
if (jumptable) {
+ ZEND_ASSERT(opnum_switch != (uint32_t)-1);
opline = &CG(active_op_array)->opcodes[opnum_switch];
opline->extended_value = get_next_op_number();
}
@@ -4917,12 +4918,11 @@ void zend_compile_try(zend_ast *ast) /* {{{ */
zend_bool is_last_catch = (i + 1 == catches->children);
uint32_t *jmp_multicatch = safe_emalloc(sizeof(uint32_t), classes->children - 1, 0);
- uint32_t opnum_catch;
+ uint32_t opnum_catch = (uint32_t)-1;
CG(zend_lineno) = catch_ast->lineno;
for (j = 0; j < classes->children; j++) {
-
zend_ast *class_ast = classes->child[j];
zend_bool is_last_class = (j + 1 == classes->children);
@@ -4972,6 +4972,7 @@ void zend_compile_try(zend_ast *ast) /* {{{ */
jmp_opnums[i + 1] = zend_emit_jump(0);
}
+ ZEND_ASSERT(opnum_catch != (uint32_t)-1 && "Should have at least one class");
opline = &CG(active_op_array)->opcodes[opnum_catch];
if (!is_last_catch) {
opline->op2.opline_num = get_next_op_number();
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index 11107e1108..06ea201608 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -2971,7 +2971,7 @@ PHP_FUNCTION(mb_strimwidth)
{
char *str, *trimmarker = NULL;
zend_string *encoding = NULL;
- zend_long from, width, swidth;
+ zend_long from, width, swidth = 0;
size_t str_len, trimmarker_len;
mbfl_string string, result, marker, *ret;
diff --git a/ext/opcache/Optimizer/scdf.c b/ext/opcache/Optimizer/scdf.c
index 96687e44f4..1c7cbc7e55 100644
--- a/ext/opcache/Optimizer/scdf.c
+++ b/ext/opcache/Optimizer/scdf.c
@@ -158,7 +158,7 @@ void scdf_solve(scdf_ctx *scdf, const char *name) {
/* Zero length blocks don't have a last instruction that would normally do this */
scdf_mark_edge_feasible(scdf, i, block->successors[0]);
} else {
- zend_op *opline;
+ zend_op *opline = NULL;
int j, end = block->start + block->len;
for (j = block->start; j < end; j++) {
opline = &scdf->op_array->opcodes[j];
@@ -170,6 +170,7 @@ void scdf_solve(scdf_ctx *scdf, const char *name) {
if (block->successors_count == 1) {
scdf_mark_edge_feasible(scdf, i, block->successors[0]);
} else if (block->successors_count > 1) {
+ ZEND_ASSERT(opline && "Should have opline in non-empty block");
if (opline->opcode == ZEND_OP_DATA) {
opline--;
j--;
diff --git a/ext/opcache/Optimizer/zend_ssa.c b/ext/opcache/Optimizer/zend_ssa.c
index f1f71f0b15..d4b024aa04 100644
--- a/ext/opcache/Optimizer/zend_ssa.c
+++ b/ext/opcache/Optimizer/zend_ssa.c
@@ -533,7 +533,7 @@ static int zend_ssa_rename(const zend_op_array *op_array, uint32_t build_flags,
int i, j;
zend_op *opline, *end;
int *tmp = NULL;
- ALLOCA_FLAG(use_heap);
+ ALLOCA_FLAG(use_heap = 0);
// FIXME: Can we optimize this copying out in some cases?
if (blocks[n].next_child >= 0) {
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index 0825cc6771..f5881c1e6c 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -1371,7 +1371,7 @@ static PHP_METHOD(PDOStatement, fetchAll)
{
zend_long how = PDO_FETCH_USE_DEFAULT;
zval data, *return_all;
- zval *arg2;
+ zval *arg2 = NULL;
zend_class_entry *old_ce;
zval old_ctor_args, *ctor_args = NULL;
int error = 0, flags, old_arg_count;
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index 205d972550..4f7d496972 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -865,6 +865,11 @@ static int php_sqlite3_callback_compare(void *coll, int a_len, const void *a, in
zval retval;
int ret;
+ // Exception occurred on previous callback. Don't attempt to call function.
+ if (EG(exception)) {
+ return 0;
+ }
+
collation->fci.fci.size = (sizeof(collation->fci.fci));
ZVAL_COPY_VALUE(&collation->fci.fci.function_name, &collation->cmp_func);
collation->fci.fci.object = NULL;
@@ -876,13 +881,8 @@ static int php_sqlite3_callback_compare(void *coll, int a_len, const void *a, in
collation->fci.fci.params = zargs;
- if (!EG(exception)) {
- //Exception occurred on previous callback. Don't attempt to call function
- if ((ret = zend_call_function(&collation->fci.fci, &collation->fci.fcc)) == FAILURE) {
- php_error_docref(NULL, E_WARNING, "An error occurred while invoking the compare callback");
- }
- } else {
- ZVAL_UNDEF(&retval);
+ if ((ret = zend_call_function(&collation->fci.fci, &collation->fci.fcc)) == FAILURE) {
+ php_error_docref(NULL, E_WARNING, "An error occurred while invoking the compare callback");
}
zval_ptr_dtor(&zargs[0]);
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index 683932216d..2668a6e51b 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -1488,7 +1488,7 @@ PHP_FUNCTION(stream_socket_enable_crypto)
zend_long cryptokind = 0;
zval *zstream, *zsessstream = NULL;
php_stream *stream, *sessstream = NULL;
- zend_bool enable, cryptokindnull;
+ zend_bool enable, cryptokindnull = 1;
int ret;
ZEND_PARSE_PARAMETERS_START(2, 4)
@@ -1502,7 +1502,7 @@ PHP_FUNCTION(stream_socket_enable_crypto)
php_stream_from_zval(stream, zstream);
if (enable) {
- if (ZEND_NUM_ARGS() < 3 || cryptokindnull) {
+ if (cryptokindnull) {
zval *val;
if (!GET_CTX_OPT(stream, "ssl", "crypto_method", val)) {
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 56b9f43da5..a4a87b3273 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -4848,7 +4848,6 @@ PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, uint8_t *stateptr, const
uint8_t state = 0;
size_t pos;
char *allow_free = NULL;
- const char *allow_actual;
char is_xml = 0;
buf = estrndup(rbuf, len);
@@ -4859,7 +4858,7 @@ PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, uint8_t *stateptr, const
br = 0;
if (allow) {
allow_free = zend_str_tolower_dup_ex(allow, allow_len);
- allow_actual = allow_free ? allow_free : allow;
+ allow = allow_free ? allow_free : allow;
tbuf = emalloc(PHP_TAG_BUF_SIZE + 1);
tp = tbuf;
} else {
@@ -4964,7 +4963,7 @@ state_1:
}
*(tp++) = '>';
*tp='\0';
- if (php_tag_find(tbuf, tp-tbuf, allow_actual)) {
+ if (php_tag_find(tbuf, tp-tbuf, allow)) {
memcpy(rp, tbuf, tp-tbuf);
rp += tp-tbuf;
}
@@ -5158,11 +5157,11 @@ finish:
*rp = '\0';
}
efree((void *)buf);
- if (allow) {
+ if (tbuf) {
efree(tbuf);
- if (allow_free) {
- efree(allow_free);
- }
+ }
+ if (allow_free) {
+ efree(allow_free);
}
if (stateptr)
*stateptr = state;