Skip to content

Commit 2e29817

Browse files
committed
Handle FETCH_DIM_R after FETCH_DIM_FUNC_ARG in inference
This can happen if a call is optimized, but FETCH_DIM_FUNC_ARG cannot be converted to FETCH_DIM_R because it uses an UNUSED op2, which is not supported by FETCH_DIM_R. Fixes oss-fuzz 6144185837682688.
1 parent f8ec5a1 commit 2e29817

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
FETCH_DIM_FUNC_ARG that cannot be optimized to FETCH_DIM_R because it appends
3+
--FILE--
4+
<?php
5+
function test($x) {
6+
test($x[][$y]);
7+
}
8+
try {
9+
test([]);
10+
} catch (Error $e) {
11+
echo $e->getMessage(), "\n";
12+
}
13+
?>
14+
--EXPECT--
15+
Cannot use [] for reading

ext/opcache/Optimizer/zend_inference.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3389,6 +3389,7 @@ static zend_always_inline int _zend_update_type_info(
33893389
* is already an object. */
33903390
break;
33913391
case ZEND_SEND_VAR:
3392+
case ZEND_FETCH_DIM_R:
33923393
/* This can occur if a DIM_FETCH_FUNC_ARG with UNUSED op2 is left
33933394
* behind, because it can't be converted to DIM_FETCH_R. */
33943395
break;

0 commit comments

Comments
 (0)