Skip to content

Commit c3a3054

Browse files
committed
JIT: Fixed incorrect guard
Fixes oss-fuzz #46704
1 parent 04e59c9 commit c3a3054

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

ext/opcache/jit/zend_jit_trace.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2027,7 +2027,9 @@ static zend_ssa *zend_jit_trace_build_tssa(zend_jit_trace_rec *trace_buffer, uin
20272027
|| Z_STRVAL_P(RT_CONSTANT(opline, opline->op2))[0] == '\0') {
20282028
break;
20292029
}
2030-
ADD_OP1_TRACE_GUARD();
2030+
if (opline->op1_type != IS_UNUSED && op1_type == IS_OBJECT) {
2031+
ADD_OP1_TRACE_GUARD();
2032+
}
20312033
break;
20322034
case ZEND_INIT_METHOD_CALL:
20332035
if (opline->op2_type != IS_CONST
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
JIT: FETCH_OBJ 010
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
--FILE--
9+
<?php
10+
function foo() {
11+
for($cnt=0;$cnt<3;$cnt++) {
12+
$obj->ary["bas"] ??= $obj = new stdClass;
13+
}
14+
}
15+
foo();
16+
?>
17+
DONE
18+
--EXPECT--
19+
DONE

0 commit comments

Comments
 (0)