Free pending named positions on partial-argument compile errors#185
Open
iliaal wants to merge 1 commit into
Open
Free pending named positions on partial-argument compile errors#185iliaal wants to merge 1 commit into
iliaal wants to merge 1 commit into
Conversation
A named placeholder in a partial application lazily allocates a named-positions table that is only consumed once argument compilation succeeds. A later argument that is itself a compile error (a positional or unpack after the named placeholder, or a misplaced variadic placeholder) longjmps out of zend_compile_args_ex before the table is consumed, leaking it. Free the table before those errors.
iliaal
force-pushed
the
fix/pfa-named-positions-leak
branch
from
July 18, 2026 23:49
31b7d61 to
c3bd629
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A partial application that uses a named placeholder (
foo(x: ?, ...)) lazily allocates a named-positions table inzend_compile_args_ex, consumed only after argument compilation succeeds. A following argument that is itself a compile error (a positional or unpack after the named placeholder, or a misplaced variadic placeholder)longjmps out of the function before the table is consumed and leaks it.This frees the table before the four reachable errors. The leak is on a
zend_bailoutpath, so ZEND_MM's leak reporter never sees it; it shows only under valgrind/ASAN. Verified withUSE_ZEND_ALLOC=0 valgrind: 376 bytes to 0 onfoo(x: ?, ?), and 0 on the unpack, named-after-variadic, and variadic-twice variants. The added test exercises the path for CI valgrind; the error output is identical before and after, so it is a path check, not an output red/green.