Skip to content

Commit

Permalink
JIT: Fix trace type inference
Browse files Browse the repository at this point in the history
Fixes oss-fuzz #43597
  • Loading branch information
dstogov committed Jan 14, 2022
1 parent 079c5af commit ee8f9d7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ext/opcache/jit/zend_jit_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1556,6 +1556,11 @@ static zend_ssa *zend_jit_trace_build_tssa(zend_jit_trace_rec *trace_buffer, uin
if (opline->result_type != IS_UNUSED) {
break;
}
if (op3_type != IS_UNKNOWN
&& !zend_jit_supported_binary_op(
opline->extended_value, MAY_BE_ANY, (1<<op3_type))) {
break;
}
/* break missing intentionally */
case ZEND_ASSIGN_DIM:
if (opline->op1_type == IS_CV) {
Expand Down
24 changes: 24 additions & 0 deletions ext/opcache/tests/jit/assign_dim_010.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--TEST--
JIT ASSIGN_DIM: 010
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=1M
--FILE--
<?php
function test() {
for($i=0; $i<10; $i++) {
$a[] &= $y;
$a = false;
$a[] =& $y;
}
}
test();
?>
DONE
--EXPECTF--
Warning: Undefined variable $a in %sassign_dim_010.php on line 4

Warning: Undefined variable $y in %sassign_dim_010.php on line 4
DONE

0 comments on commit ee8f9d7

Please sign in to comment.