[php-src] PR #20326: Prevent ASSIGN_OP / ASSIGN_DIM_OP lvalue from being released during assignment
| From: | arnaud-lb | Date: | Wed, 29 Oct 2025 11:21:07 +0000 |
| Subject: | [php-src] PR #20326: Prevent ASSIGN_OP / ASSIGN_DIM_OP lvalue from being released during assignment | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-33843@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/20326
Author: arnaud-lb
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 when the symbol table is resize. 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: https://github.com/php/php-src/issues/15938