Skip to content

Commit 81cb005

Browse files
committed
Fix type inference
Fixes oss-fuzz #50792
1 parent 6aedc5e commit 81cb005

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

ext/opcache/Optimizer/zend_inference.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3319,6 +3319,9 @@ static zend_always_inline int _zend_update_type_info(
33193319
opline->op1_type,
33203320
opline->result_type == IS_VAR,
33213321
opline->op2_type == IS_UNUSED);
3322+
if (opline->opcode == ZEND_FETCH_DIM_FUNC_ARG && (t1 & (MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_RESOURCE))) {
3323+
tmp |= MAY_BE_NULL;
3324+
}
33223325
if (opline->opcode == ZEND_FETCH_DIM_IS && (t1 & MAY_BE_STRING)) {
33233326
tmp |= MAY_BE_NULL;
33243327
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
JIT FETCH_DIM_FUNC_ARG: 002
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
--SKIPIF--
9+
<?php require_once('skipif.inc'); ?>
10+
--FILE--
11+
<?php
12+
new class(true[""]) {
13+
}
14+
?>
15+
DONE
16+
--EXPECTF--
17+
Warning: Trying to access array offset on value of type bool in %sfetch_dim_func_arg_002.php on line 2
18+
DONE

0 commit comments

Comments
 (0)