1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

zend_hash_check_size: allow nSize <= HT_MAX_SIZE (#10244)

This is consistent with other uses of HT_MAX_SIZE
This commit is contained in:
Arnaud Le Blanc
2023-01-13 17:42:43 +01:00
committed by GitHub
parent 7473b86f10
commit 2b1907786c

View File

@@ -119,7 +119,7 @@ static zend_always_inline uint32_t zend_hash_check_size(uint32_t nSize)
/* size should be between HT_MIN_SIZE and HT_MAX_SIZE */
if (nSize <= HT_MIN_SIZE) {
return HT_MIN_SIZE;
} else if (UNEXPECTED(nSize >= HT_MAX_SIZE)) {
} else if (UNEXPECTED(nSize > HT_MAX_SIZE)) {
zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%u * %zu + %zu)", nSize, sizeof(Bucket), sizeof(Bucket));
}