[php-src] PR #22039: Zend: Fix string leak in zend_update_property_string{,l} on write failure
| From: | iliaal | Date: | Wed, 13 May 2026 20:30:57 +0000 |
| Subject: | [php-src] PR #22039: Zend: Fix string leak in zend_update_property_string{,l} on write failure | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36120@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22039
Author: iliaal
The four
zend_update_{,static_}property_string{,l}() helpers set the local
tmp zval refcount to 0 so the consume path can absorb the only reference. Every
write-rejection path returns before that consume happens (readonly property, asymmetric visibility,
type mismatch, missing static property, magic __set throw, type-check rejection on a
typed static), and the local zend_string leaks at refcount 0. Reproduces as a 64-byte
orphan under --enable-debug or ASan. Fix builds the zval at refcount 1 and
zval_ptr_dtors it after the write; the consumer's Z_TRY_ADDREF_P and
the local dtor balance, slot end state matches the pre-patch value.