]> granicus.if.org Git - php/commitdiff
Fixed overflow handling
authorDmitry Stogov <dmitry@zend.com>
Fri, 10 Apr 2020 11:42:26 +0000 (14:42 +0300)
committerDmitry Stogov <dmitry@zend.com>
Fri, 10 Apr 2020 11:42:26 +0000 (14:42 +0300)
ext/opcache/jit/zend_jit_trace.c
ext/opcache/jit/zend_jit_x86.dasc

index 01ea6fa977ec5ccb869751eb10044b4fce63cdf1..e42970b97d7a047530058b4f13338cfcf9aacfa1 100644 (file)
@@ -1899,6 +1899,10 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
                                                                ssa->var_info[ssa_op->result_def].type &= ~MAY_BE_GUARD;
                                                        }
                                                }
+                                               if (opline->result_type != IS_UNUSED
+                                                && (res_info & (MAY_BE_ANY|MAY_BE_GUARD)) == (MAY_BE_LONG|MAY_BE_GUARD)) {
+                                                       ssa->var_info[ssa_op->result_def].type &= ~MAY_BE_GUARD;
+                                               }
                                                goto done;
                                        case ZEND_BW_OR:
                                        case ZEND_BW_AND:
index 7fa4f108ea13155bdd507629f3dea4092e1c75dc..df9c52ab43833ee8352107719398ab0f0e65c9e5 100644 (file)
@@ -3411,10 +3411,14 @@ static int zend_jit_inc_dec(dasm_State **Dst, const zend_op *opline, const zend_
                |       LONG_OP_WITH_CONST sub, op1_def_addr, Z_L(1)
        }
 
-       if (may_overflow && (op1_def_info & MAY_BE_GUARD)) {
+       if (may_overflow && ((op1_def_info & MAY_BE_GUARD) || (opline->result_type != IS_UNUSED && (res_info & MAY_BE_GUARD)))) {
                int32_t exit_point = zend_jit_trace_get_exit_point(opline, opline, NULL);
                const void *exit_addr = zend_jit_trace_get_exit_addr(exit_point);
                |       jo &exit_addr
+               if ((opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_PRE_DEC) &&
+                   opline->result_type != IS_UNUSED) {
+                       |       ZVAL_COPY_VALUE res_addr, res_use_info, op1_def_addr, MAY_BE_LONG, ZREG_R0, ZREG_R1
+               }
        } else if (may_overflow) {
                |       jo >1
                if ((opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_PRE_DEC) &&