com php-src: Fix bug #70423 Warning Internal error: wrong size calculation: ext/opcache/zend_persist_calc.c

From: Date: Mon, 07 Sep 2015 13:02:33 +0000
Subject: com php-src: Fix bug #70423 Warning Internal error: wrong size calculation: ext/opcache/zend_persist_calc.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-88942@lists.php.net to get a copy of this message
Commit: eaf96698c7e3229b0217ca3a408fb3b50b9bd333 Author: Anatol Belski <ab@php.net> Mon, 7 Sep 2015 15:02:33 +0200 Parents: db99b877f0d5fc29b298021ef401acd196062d7d Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=eaf96698c7e3229b0217ca3a408fb3b50b9bd333 Log: Fix bug #70423 Warning Internal error: wrong size calculation Bugs: https://bugs.php.net/70423 Changed paths: M ext/opcache/zend_persist_calc.c Diff: diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c index bad7d70..3b8356a 100644 --- a/ext/opcache/zend_persist_calc.c +++ b/ext/opcache/zend_persist_calc.c @@ -60,15 +60,18 @@ static void zend_hash_persist_calc(HashTable *ht, void (*pPersistElement)(zval * if (!(ht->u.flags & HASH_FLAG_PACKED) && ht->nNumUsed < -(int32_t)ht->nTableMask / 2) { /* compact table */ - int32_t hash_size = -(int32_t)ht->nTableMask; + int32_t hash_size; - while (hash_size >> 1 > ht->nNumUsed) { - hash_size >>= 1; - } - if (hash_size < HT_MIN_SIZE) { + if (ht->nNumUsed <= HT_MIN_SIZE) { hash_size = HT_MIN_SIZE; + } else { + hash_size = -(int32_t)ht->nTableMask; + while (hash_size >> 1 > ht->nNumUsed) { + hash_size >>= 1; + } } ADD_SIZE(hash_size * sizeof(uint32_t) + ht->nNumUsed * sizeof(Bucket)); + ZEND_ASSERT(((zend_uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */ } else { ADD_SIZE(HT_USED_SIZE(ht)); }

« previous php.cvs (#88942) next »