Skip to content

Commit 33704be

Browse files
committed
Trcing JIT: remove unchecked type guards om ROPE_* instructions
Fixes oss-fuzz #46209
1 parent 24bb178 commit 33704be

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

ext/opcache/jit/zend_jit_trace.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2062,7 +2062,9 @@ static zend_ssa *zend_jit_trace_build_tssa(zend_jit_trace_rec *trace_buffer, uin
20622062
case ZEND_ROPE_INIT:
20632063
case ZEND_ROPE_ADD:
20642064
case ZEND_ROPE_END:
2065-
ADD_OP2_TRACE_GUARD();
2065+
if (op2_type == IS_STRING) {
2066+
ADD_OP2_TRACE_GUARD();
2067+
}
20662068
break;
20672069
default:
20682070
break;

ext/opcache/tests/jit/rope_002.phpt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
JIT ROPE: 002 type guards are only checked for strings
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+
$a = 0;
12+
for ($cnt = 0; $cnt < 6; $cnt++) {
13+
$array[] = &$y;
14+
$S["$array[$a] $y"] = $a += $y;
15+
}
16+
}
17+
foo();
18+
?>
19+
DONE
20+
--EXPECT--
21+
DONE

0 commit comments

Comments
 (0)