Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix GH-20319: Prevent ASSIGN_OP / ASSIGN_DIM_OP lvalue from being invalidated during assignment #20326

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
arnaud-lb wants to merge 1 commit into php:master
base: master
Choose a base branch
Loading
from arnaud-lb:gh20319

Conversation

@arnaud-lb
Copy link
Member

@arnaud-lb arnaud-lb commented Oct 29, 2025
edited
Loading

In ASSIGN_DIM_OP, side effects of coercion may release the array or make the dimension pointer invalid (by reallocating the array). Increasing the array's refcount around the binary op is enough to prevent both issues.

In ASSIGN_OP, if the variable is a reference, side effects may release it. If the variable is a var-var slot, it may be invalidated if the symbol table is resized. In the former case, increase the refcount around the binary op. In the latter, turn the slot into a reference so we can apply the same fix.

Fixes: GH-20319
Related: GH-15938

@arnaud-lb arnaud-lb changed the title (削除) Prevent ASSIGN_OP / ASSIGN_DIM_OP lvalue from being released during assignment (削除ここまで) (追記) Prevent ASSIGN_OP / ASSIGN_DIM_OP lvalue from being invalidated during assignment (追記ここまで) Oct 29, 2025
@arnaud-lb arnaud-lb force-pushed the gh20319 branch 2 times, most recently from 572d766 to 5f2757d Compare October 29, 2025 15:01
...ssignment
In ASSIGN_DIM_OP, side effects of coercion may release the array or make the
dimension pointer invalid (by reallocating the array). Increasing the array's
refcount around the binary op is enough to prevent both issues.
In ASSIGN_OP, if the variable is a reference, side effects may release it.
Again, increasing the refcount prevents this.
@arnaud-lb arnaud-lb marked this pull request as ready for review October 29, 2025 16:30
@arnaud-lb arnaud-lb changed the title (削除) Prevent ASSIGN_OP / ASSIGN_DIM_OP lvalue from being invalidated during assignment (削除ここまで) (追記) Fix GH-GH-20319: Prevent ASSIGN_OP / ASSIGN_DIM_OP lvalue from being invalidated during assignment (追記ここまで) Oct 30, 2025
@arnaud-lb arnaud-lb changed the title (削除) Fix GH-GH-20319: Prevent ASSIGN_OP / ASSIGN_DIM_OP lvalue from being invalidated during assignment (削除ここまで) (追記) Fix GH-20319: Prevent ASSIGN_OP / ASSIGN_DIM_OP lvalue from being invalidated during assignment (追記ここまで) Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@dstogov dstogov Awaiting requested review from dstogov dstogov is a code owner

@iluuu1994 iluuu1994 Awaiting requested review from iluuu1994

@ndossche ndossche Awaiting requested review from ndossche

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Side effects during ASSIGN_OP / ASSIGN_DIM_OP may invalidate lvalue

1 participant

AltStyle によって変換されたページ (->オリジナル) /