[php-src] PR #22545: Check the stack limit when calling internal functions
| From: | iliaal | Date: | Thu, 02 Jul 2026 00:47:06 +0000 |
| Subject: | [php-src] PR #22545: Check the stack limit when calling internal functions | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36769@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22545
Author: iliaal
GH-16492 fixes GH-15911 by guarding AppendIterator against appending to itself; this is the general
form. An internal function that recurses through zend_call_function (which invokes internal handlers
directly, with no VM frame and no stack-limit check) never yields back to the VM, so the C stack
overflows into a SEGV. This adds the interpreter's stack-limit check to that path, behind
ZEND_CHECK_STACK_LIMIT, raising the usual "Maximum call stack size reached" error instead.
It covers a MultipleIterator (GH-15672) or AppendIterator (GH-15911) attached to itself and a mutual
cycle between two such iterators that a per-iterator guard cannot see. For a pure
internal-to-internal cycle the error is uncatchable, since there is no user frame in the recursion
to unwind into. Fixes php/php-src#15672 and php/php-src#15911.