Skip to content

Commit 96c469a

Browse files
committed
Assert the new hash size is a power of 2
1 parent a9328b1 commit 96c469a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Zend/zend_hash.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,9 @@ ZEND_API void ZEND_FASTCALL zend_hash_packed_to_hash(HashTable *ht)
345345
if (nSize < HT_MIN_SIZE_UNPACKED) {
346346
nSize = HT_MIN_SIZE_UNPACKED;
347347
ht->nTableSize = HT_MIN_SIZE_UNPACKED;
348+
} else if (nSize & (nSize - 1)) {
349+
nSize = zend_hash_check_size(nSize);
350+
ht->nTableSize = nSize;
348351
}
349352

350353
HT_ASSERT_RC1(ht);

0 commit comments

Comments
 (0)