[php-src] PR #22896: ext/soap: to_xml_array() heap use-after-free with illegal iterator keys.
| From: | devnexen | Date: | Mon, 27 Jul 2026 04:17:12 +0000 |
| Subject: | [php-src] PR #22896: ext/soap: to_xml_array() heap use-after-free with illegal iterator keys. | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-37287@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22896
Author: devnexen
Fix #22895
The return value of array_set_zval_key() was ignored, so when the key is not a legal array offset,
e.g. MultipleIterator::key() returning an array, it threw and took no reference. The unconditional
zval_ptr_dtor() then dropped the iterator's only reference to the borrowed value and the
following Z_TRY_ADDREF_P() read freed memory.
Let array_set_zval_key() own its reference the way spl_iterator_to_array_apply() does, and stop
iterating on failure.