Skip to content

Commit 831a171

Browse files
committed
JIT: Fixed incorrect overflow detection introduced in a5e502e
1 parent 80205cd commit 831a171

File tree

4 files changed

+37
-1
lines changed

4 files changed

+37
-1
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12823,6 +12823,8 @@ static int zend_jit_incdec_obj(dasm_State **Dst,
1282312823
}
1282412824
if (opline->result_type != IS_UNUSED
1282512825
&& (opline->opcode == ZEND_PRE_INC_OBJ || opline->opcode == ZEND_PRE_DEC_OBJ)
12826+
&& prop_info
12827+
&& !ZEND_TYPE_IS_SET(prop_info->type)
1282612828
&& (res_info & MAY_BE_GUARD)
1282712829
&& (res_info & MAY_BE_LONG)) {
1282812830
int32_t exit_point = zend_jit_trace_get_exit_point(opline + 1, 0);

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13549,6 +13549,8 @@ static int zend_jit_incdec_obj(dasm_State **Dst,
1354913549
}
1355013550
if (opline->result_type != IS_UNUSED
1355113551
&& (opline->opcode == ZEND_PRE_INC_OBJ || opline->opcode == ZEND_PRE_DEC_OBJ)
13552+
&& prop_info
13553+
&& !ZEND_TYPE_IS_SET(prop_info->type)
1355213554
&& (res_info & MAY_BE_GUARD)
1355313555
&& (res_info & MAY_BE_LONG)) {
1355413556
int32_t exit_point = zend_jit_trace_get_exit_point(opline + 1, 0);

ext/opcache/tests/jit/inc_obj_001.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ opcache.enable_cli=1
66
opcache.file_update_protection=0
77
opcache.jit_buffer_size=1M
88
opcache.protect_memory=1
9-
opcache.jit=function
109
--FILE--
1110
<?php
1211
class Test {
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
--TEST--
2+
PRE_INC_OBJ: 002
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
opcache.protect_memory=1
9+
--FILE--
10+
<?php
11+
class Test {
12+
function foo() {
13+
$this->prop = PHP_INT_MAX - 5;
14+
for ($i = 0; $i < 10; $i++) {
15+
var_dump(++$this->prop);
16+
}
17+
}
18+
}
19+
20+
$test = new Test;
21+
$test->foo();
22+
?>
23+
--EXPECTF--
24+
int(%d)
25+
int(%d)
26+
int(%d)
27+
int(%d)
28+
int(%d)
29+
float(%f)
30+
float(%f)
31+
float(%f)
32+
float(%f)
33+
float(%f)

0 commit comments

Comments
 (0)