Repository navigation
Conversation
…ainer When OP_DATA is an undefined variable, the warning was raised while ASSIGN_DIM, ASSIGN_DIM_OP, ASSIGN_OBJ and ASSIGN_OBJ_OP still held a pointer into the container, so an error handler releasing or modifying it left that pointer dangling. Keep the array or the fetched container alive across the warning, and skip the assignment if the array was destroyed or shared.
jorgsowa
force-pushed
the
fix-assign-dim-undef-op-data-uaf
branch
from
November 24, 2026 22:19
9dc6745 to
4bae794
Compare
jorgsowa
marked this pull request as ready for review
November 24, 2026 22:19
… target Function JIT leaves ASSIGN_OBJ with a possibly undefined OP_DATA to the VM handler and tracing JIT exits to the VM on it, so the object is no longer used after the warning. The typed reference helpers keep the reference alive across the warning.
jorgsowa
force-pushed
the
fix-assign-dim-undef-op-data-uaf
branch
from
November 24, 2026 22:28
4bae794 to
8e9fe07
Compare
Member
|
See #20018. I don't think this should be fixed (especially not on stable branches). |
Contributor
Author
|
If so, I may skip failing test |
Member
|
@jorgsowa I can do that right now. I was just checking whether any other tests also fail, but the rest seem to be ok. |
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.
An error handler for "Undefined variable" on the assigned value can free or modify the array or object being written to. The engine still holds a pointer into it. This is what breaks assign_dim_undef_op_data_008.phpt (added in #24665) on the nightly MSAN and PPC64 ASAN builds.
VM (commit 1) — on its own this fixes the nightly builds, which run without JIT:
ASSIGN_DIM/ASSIGN_DIM_OP: hold the array across the warning, and skip the write if the handler destroyed or shared it. This matcheszend_undefined_offset_write().ASSIGN_OBJ/ASSIGN_OBJ_OPwith a fetched container ($a[0]->p = $undef): copy the container into the instruction's own slot before the warning.JIT (commit 2):
ASSIGN_OBJto the VM when the value may be undefined. (trade-off)