]> granicus.if.org Git - php/commitdiff
Fixed segfault while with generating ext info
authorXinchen Hui <laruence@php.net>
Mon, 6 Jul 2015 07:22:40 +0000 (15:22 +0800)
committerXinchen Hui <laruence@php.net>
Mon, 6 Jul 2015 07:22:40 +0000 (15:22 +0800)
Zend/zend_execute.h
Zend/zend_vm_def.h
Zend/zend_vm_execute.h

index f595edca9bc78e8ed78588593a27c1f7e8a8fc75..2f8f637c641daf5cc21afcbdef6a646634682633 100644 (file)
@@ -355,6 +355,13 @@ void zend_cleanup_unfinished_execution(zend_execute_data *execute_data, uint32_t
                (slot)[1] = (ptr); \
        } while (0)
 
+#define SKIP_EXT_OPLINE(opline) do { \
+               while (UNEXPECTED((opline)->opcode <= ZEND_TICKS \
+                       && (opline)->opcode >= ZEND_EXT_STMT)) {     \
+                       (opline)--;                                  \
+               }                                                \
+       } while (0)
+
 END_EXTERN_C()
 
 #endif /* ZEND_EXECUTE_H */
index d31bf9b88e2a1b3d36cf8ecbd76e401b1218bb10..fb86a8d42a077490db7d892ac6283f802158b8e2 100644 (file)
@@ -7868,9 +7868,10 @@ ZEND_VM_HANDLER(151, ZEND_ASSERT_CHECK, ANY, ANY)
 
        if (EG(assertions) <= 0) {
                zend_op *target = OP_JMP_ADDR(opline, opline->op2);
-
-               if (RETURN_VALUE_USED(target-1)) {
-                       ZVAL_TRUE(EX_VAR((target-1)->result.var));
+               zend_op *result = target - 1;
+               SKIP_EXT_OPLINE(result);
+               if (RETURN_VALUE_USED(result)) {
+                       ZVAL_TRUE(EX_VAR(result->result.var));
                }
                ZEND_VM_JMP(target);
        } else {
index 1d788812323041c0bb77e16dce6d01b2696e76a8..a948964e91bf0f068d6df4f462448ac37459e809 100644 (file)
@@ -1657,9 +1657,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSERT_CHECK_SPEC_HANDLER(ZEND
 
        if (EG(assertions) <= 0) {
                zend_op *target = OP_JMP_ADDR(opline, opline->op2);
-
-               if (RETURN_VALUE_USED(target-1)) {
-                       ZVAL_TRUE(EX_VAR((target-1)->result.var));
+               zend_op *result = target - 1;
+               SKIP_EXT_OPLINE(result);
+               if (RETURN_VALUE_USED(result)) {
+                       ZVAL_TRUE(EX_VAR(result->result.var));
                }
                ZEND_VM_JMP(target);
        } else {