From 5e63a1b4c1a48ed018801db8967465b152777995 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Fri, 30 Aug 2024 20:06:58 +0200 Subject: [PATCH 1/2] Fix GH-15661: Access null pointer in Zend/Optimizer/zend_inference.c --- Zend/Optimizer/zend_inference.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: From fa87c99300e2cb7611ae521491a9a8b160627acd Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Fri, 6 Sep 2024 22:58:37 +0200 Subject: [PATCH 2/2] Add test --- ext/opcache/tests/jit/gh15666.phpt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 ext/opcache/tests/jit/gh15666.phpt 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