Skip to content

Conversation

@arnaud-lb
Copy link
Member

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

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 requested a review from dstogov as a code owner 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Side effects during ASSIGN_OP / ASSIGN_DIM_OP may invalidate lvalue

1 participant