[php-src] Issue #8438: HashTableIterators of empty hashtables are not poisoned upon free
| From: | bwoebi | Date: | Mon, 25 Apr 2022 15:35:24 +0000 |
| Subject: | [php-src] Issue #8438: HashTableIterators of empty hashtables are not poisoned upon free | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-241231@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8438
Author: bwoebi
### Description
Using the
zend_hash_iterators_* API, non-empty arrays are properly marked as poisoned
in the HashTableIterator entries.
However there is an edge case: if nNumUsed == 0, then the
zend_hash_iterators_remove call is skipped in zend_hash_destroy and
zend_array_destroy.
Thus, we either should:
a) fix this by always calling the removal ... or
b) completely remove the auto-removal on destruction and leave it the extension authors
responsibility to clear the iterators
From the perspective of the code in php-src there is no need to have the auto-removal on free, as
every iterating thing holds a reference to it.
### PHP Version
master
### Operating System
_No response_