You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Typo in zend_hash_iterator_pos_ex() checks !HT_ITERATORS_OVERFLOW(ht) instead of !HT_ITERATORS_OVERFLOW(iter->ht) #24667
In Zend/zend_hash.c (lines 627–654), zend_hash_iterator_pos_ex(uint32_t idx, zval *array) decrements the iterator count on the old HashTable (iter->ht) when iter->ht != ht and !zend_hash_iterator_find_copy_pos(idx, ht):
Compare this with zend_hash_iterator_pos() right above it (Zend/zend_hash.c, lines 614–617):
if (EXPECTED(iter->ht) &&EXPECTED(iter->ht!=HT_POISONED_PTR)
&&EXPECTED(!HT_ITERATORS_OVERFLOW(iter->ht))) {
HT_DEC_ITERATORS_COUNT(iter->ht);
}
On line 635, zend_hash_iterator_pos_ex() mistakenly checks !HT_ITERATORS_OVERFLOW(ht) (the new ht) instead of !HT_ITERATORS_OVERFLOW(iter->ht) (the old iter->ht whose nIteratorsCount is about to be decremented by HT_DEC_ITERATORS_COUNT(iter->ht)).
If iter->ht had overflowed its 8-bit nIteratorsCount counter (0xff) while ht has not, HT_DEC_ITERATORS_COUNT(iter->ht) will erroneously decrement iter->ht's saturated counter. Conversely, if ht had overflowed while iter->ht had not, iter->ht's counter will not be decremented.
changed the title [-]zend_hash_iterator_pos_ex() calls zend_hash_iterator_pos() without _ex in fallback path[/-][+]Typo in zend_hash_iterator_pos_ex() checks !HT_ITERATORS_OVERFLOW(ht) instead of !HT_ITERATORS_OVERFLOW(iter->ht)[/+]on Oct 25, 2026
Activity
[-]zend_hash_iterator_pos_ex() calls zend_hash_iterator_pos() without _ex in fallback path[/-][+]Typo in zend_hash_iterator_pos_ex() checks !HT_ITERATORS_OVERFLOW(ht) instead of !HT_ITERATORS_OVERFLOW(iter->ht)[/+]ndossche commentedon Oct 25, 2026
This overlaps exactly with #23401, so closing as a duplicate
cc @iliaal