[php-src] PHP-8.4: Fix OSS-Fuzz #546798343: Heap-buffer-overflow in zend_delete_call_instructions with callable conversion
| From: | ndossche | Date: | Sat, 19 Sep 2026 21:54:47 +0000 |
| Subject: | [php-src] PHP-8.4: Fix OSS-Fuzz #546798343: Heap-buffer-overflow in zend_delete_call_instructions with callable conversion | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141295@lists.php.net to get a copy of this message | ||
Author: ndossche (ndossche)
Date: 2026-09-19T23:47:23+02:00
Commit: https://github.com/php/php-src/commit/3213c3faa641265868f0d6aec3c17462382d5809
Raw diff: https://github.com/php/php-src/commit/3213c3faa641265868f0d6aec3c17462382d5809.diff
Fix OSS-Fuzz #546798343: Heap-buffer-overflow in zend_delete_call_instructions with callable
conversion
Call level counter was broken: ZEND_CALLABLE_CONVERT was forgotten.
Closes GH-23777.
Changed paths:
A ext/opcache/tests/opt/oss_fuzz_546798343.phpt
M NEWS
M Zend/Optimizer/optimize_func_calls.c
Diff:
diff --git a/NEWS b/NEWS
index 51580b6c7781..2eef981bcf60 100644
--- a/NEWS
+++ b/NEWS
@@ -34,6 +34,10 @@ PHP NEWS
. Fixed bug GH-23106 (mb_strpos() reads past the end of a haystack ending in
a truncated UTF-8 sequence). (Lazizbek Ergashev)
+- Opcache:
+ . Fixed OSS-Fuzz #546798343 (Heap-buffer-overflow in optimizer with
+ FCCs and inlining). (ndossche)
+
- PDO:
. Fixed PDOStatement::getColumnMeta() reading out of bounds for an invalid
column index. (Ilia Alshanetsky)
diff --git a/Zend/Optimizer/optimize_func_calls.c b/Zend/Optimizer/optimize_func_calls.c
index ce6c43afaedb..5449535c560a 100644
--- a/Zend/Optimizer/optimize_func_calls.c
+++ b/Zend/Optimizer/optimize_func_calls.c
@@ -63,6 +63,7 @@ static void zend_delete_call_instructions(zend_op_array *op_array, zend_op *opli
case ZEND_DO_ICALL:
case ZEND_DO_UCALL:
case ZEND_DO_FCALL_BY_NAME:
+ case ZEND_CALLABLE_CONVERT:
call++;
break;
case ZEND_SEND_VAL:
diff --git a/ext/opcache/tests/opt/oss_fuzz_546798343.phpt
b/ext/opcache/tests/opt/oss_fuzz_546798343.phpt
new file mode 100644
index 000000000000..f7f058a11652
--- /dev/null
+++ b/ext/opcache/tests/opt/oss_fuzz_546798343.phpt
@@ -0,0 +1,19 @@
+--TEST--
+OSS-Fuzz #546798343 (Heap-buffer-overflow in zend_delete_call_instructions with callable
conversion)
+--EXTENSIONS--
+opcache
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+--FILE--
+<?php
+
+$x = function() {};
+gonnaBeInlined($x(...));
+function gonnaBeInlined($foo) {
+}
+
+echo "Done";
+?>
+--EXPECT--
+Done