diff --git a/Zend/Optimizer/zend_inference.c b/Zend/Optimizer/zend_inference.c index b7fa1e837d096..1c5e99dd30ab3 100644 --- a/Zend/Optimizer/zend_inference.c +++ b/Zend/Optimizer/zend_inference.c @@ -5040,7 +5040,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op return 0; case ZEND_BIND_GLOBAL: if ((opline+1)->opcode == ZEND_BIND_GLOBAL) { - return zend_may_throw(opline + 1, ssa_op + 1, op_array, ssa); + return zend_may_throw(opline + 1, ssa_op ? ssa_op + 1 : NULL, op_array, ssa); } return 0; case ZEND_ADD: diff --git a/ext/opcache/tests/jit/gh15666.phpt b/ext/opcache/tests/jit/gh15666.phpt new file mode 100644 index 0000000000000..090003e055abe --- /dev/null +++ b/ext/opcache/tests/jit/gh15666.phpt @@ -0,0 +1,21 @@ +--TEST-- +GH-15661 (Access null pointer in Zend/Optimizer/zend_inference.c) +--EXTENSIONS-- +opcache +--INI-- +opcache.jit=1201 +opcache.jit_buffer_size=64M +--FILE-- + +--EXPECT-- +Done