Skip to content

Commit b5f8a72

Browse files
committed
Fixed incorrect QM_ASSIGN elimination
Fixes OSS Fuzz #60895
1 parent 6b6a5cd commit b5f8a72

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

Zend/Optimizer/block_pass.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
174174
&& opline->opcode != ZEND_MATCH
175175
&& zend_optimizer_update_op1_const(op_array, opline, &c)) {
176176
VAR_SOURCE(op1) = NULL;
177-
if (!zend_bitset_in(used_ext, VAR_NUM(src->result.var))) {
177+
if (opline->opcode != ZEND_JMP_NULL
178+
&& !zend_bitset_in(used_ext, VAR_NUM(src->result.var))) {
178179
literal_dtor(&ZEND_OP1_LITERAL(src));
179180
MAKE_NOP(src);
180181
}
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
Block Pass 005: Inorrect QM_ASSIGN elimination
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.optimization_level=-1
7+
--EXTENSIONS--
8+
opcache
9+
--FILE--
10+
<?php
11+
y??(1?4:y)?->y;
12+
?>
13+
--EXPECTF--
14+
Fatal error: Uncaught Error: Undefined constant "y" in %sblock_pass_005.php:2
15+
Stack trace:
16+
#0 {main}
17+
thrown in %sblock_pass_005.php on line 2

0 commit comments

Comments
 (0)