Skip to content

Commit

Permalink
Fix assertion
Browse files Browse the repository at this point in the history
Fixes oss-fuzz #65233
  • Loading branch information
dstogov committed Dec 25, 2023
1 parent d98a45d commit 5350952
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Zend/zend_opcode.c
Expand Up @@ -867,12 +867,12 @@ static bool keeps_op1_alive(zend_op *opline) {
|| opline->opcode == ZEND_SWITCH_STRING
|| opline->opcode == ZEND_MATCH
|| opline->opcode == ZEND_FETCH_LIST_R
|| opline->opcode == ZEND_FETCH_LIST_W
|| opline->opcode == ZEND_COPY_TMP) {
return 1;
}
ZEND_ASSERT(opline->opcode != ZEND_FE_FETCH_R
&& opline->opcode != ZEND_FE_FETCH_RW
&& opline->opcode != ZEND_FETCH_LIST_W
&& opline->opcode != ZEND_VERIFY_RETURN_TYPE
&& opline->opcode != ZEND_BIND_LEXICAL
&& opline->opcode != ZEND_ROPE_ADD);
Expand Down
12 changes: 12 additions & 0 deletions ext/opcache/tests/opt/dce_014.phpt
@@ -0,0 +1,12 @@
--TEST--
DCE may remove FREE after FETCH_LIST_W
--FILE--
<?php
function () {
$a = $r[][] = $r = [] & $y;
+list(&$y) = $a;
}
?>
DONE
--EXPECT--
DONE

0 comments on commit 5350952

Please sign in to comment.