Skip to content

Commit ee8f9d7

Browse files
committed
JIT: Fix trace type inference
Fixes oss-fuzz #43597
1 parent 079c5af commit ee8f9d7

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

ext/opcache/jit/zend_jit_trace.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,6 +1556,11 @@ static zend_ssa *zend_jit_trace_build_tssa(zend_jit_trace_rec *trace_buffer, uin
15561556
if (opline->result_type != IS_UNUSED) {
15571557
break;
15581558
}
1559+
if (op3_type != IS_UNKNOWN
1560+
&& !zend_jit_supported_binary_op(
1561+
opline->extended_value, MAY_BE_ANY, (1<<op3_type))) {
1562+
break;
1563+
}
15591564
/* break missing intentionally */
15601565
case ZEND_ASSIGN_DIM:
15611566
if (opline->op1_type == IS_CV) {
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
JIT ASSIGN_DIM: 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 test() {
11+
for($i=0; $i<10; $i++) {
12+
$a[] &= $y;
13+
$a = false;
14+
$a[] =& $y;
15+
}
16+
}
17+
test();
18+
?>
19+
DONE
20+
--EXPECTF--
21+
Warning: Undefined variable $a in %sassign_dim_010.php on line 4
22+
23+
Warning: Undefined variable $y in %sassign_dim_010.php on line 4
24+
DONE

0 commit comments

Comments
 (0)