JIT: Fixed incorrect overflow detection introduced in a5e502ef4d

This commit is contained in:
Dmitry Stogov 2021-10-06 10:18:18 +03:00
parent 80205cd39a
commit 831a1717f6
4 changed files with 37 additions and 1 deletions

View File

@ -12823,6 +12823,8 @@ static int zend_jit_incdec_obj(dasm_State **Dst,
}
if (opline->result_type != IS_UNUSED
&& (opline->opcode == ZEND_PRE_INC_OBJ || opline->opcode == ZEND_PRE_DEC_OBJ)
&& prop_info
&& !ZEND_TYPE_IS_SET(prop_info->type)
&& (res_info & MAY_BE_GUARD)
&& (res_info & MAY_BE_LONG)) {
int32_t exit_point = zend_jit_trace_get_exit_point(opline + 1, 0);

View File

@ -13549,6 +13549,8 @@ static int zend_jit_incdec_obj(dasm_State **Dst,
}
if (opline->result_type != IS_UNUSED
&& (opline->opcode == ZEND_PRE_INC_OBJ || opline->opcode == ZEND_PRE_DEC_OBJ)
&& prop_info
&& !ZEND_TYPE_IS_SET(prop_info->type)
&& (res_info & MAY_BE_GUARD)
&& (res_info & MAY_BE_LONG)) {
int32_t exit_point = zend_jit_trace_get_exit_point(opline + 1, 0);

View File

@ -6,7 +6,6 @@ opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=1M
opcache.protect_memory=1
opcache.jit=function
--FILE--
<?php
class Test {

View File

@ -0,0 +1,33 @@
--TEST--
PRE_INC_OBJ: 002
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=1M
opcache.protect_memory=1
--FILE--
<?php
class Test {
function foo() {
$this->prop = PHP_INT_MAX - 5;
for ($i = 0; $i < 10; $i++) {
var_dump(++$this->prop);
}
}
}
$test = new Test;
$test->foo();
?>
--EXPECTF--
int(%d)
int(%d)
int(%d)
int(%d)
int(%d)
float(%f)
float(%f)
float(%f)
float(%f)
float(%f)