Skip to content

Commit 0d6b173

Browse files
committed
JIT: Fix missed type store
Fizes oss-fuzz #44376
1 parent d0f965d commit 0d6b173

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

ext/opcache/jit/zend_jit.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2732,6 +2732,9 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
27322732
op2_def_addr = op2_addr;
27332733
}
27342734
op1_info = OP1_INFO();
2735+
if (ra && ssa->vars[ssa_op->op1_use].no_val) {
2736+
op1_info |= MAY_BE_UNDEF; // requres type assignment
2737+
}
27352738
if (opline->result_type == IS_UNUSED) {
27362739
res_addr = 0;
27372740
res_info = -1;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
Register Alloction 009: Missing type store
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(;; $a + $y[4][] = $y < $a + $a = $b = $a = + $y[] = 0.1) {
12+
4 >> - $j++;
13+
}
14+
}
15+
test();
16+
?>
17+
--EXPECTF--
18+
Warning: Undefined variable $j in %sreg_alloc_009.php on line 4
19+
20+
Fatal error: Uncaught ArithmeticError: Bit shift by negative number in %sreg_alloc_009.php:4
21+
Stack trace:
22+
#0 %sreg_alloc_009.php(7): test()
23+
#1 {main}
24+
thrown in %sreg_alloc_009.php on line 4

0 commit comments

Comments
 (0)