diff options
Diffstat (limited to 'Zend')
| -rw-r--r-- | Zend/zend_strtod.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Zend/zend_strtod.c b/Zend/zend_strtod.c index 90b922915d..798d94a384 100644 --- a/Zend/zend_strtod.c +++ b/Zend/zend_strtod.c @@ -459,12 +459,20 @@ static Bigint * Balloc(int k) int x; Bigint *rv; + if (k > Kmax) { + zend_error(E_ERROR, "Balloc() allocation exceeds list boundary"); + } + _THREAD_PRIVATE_MUTEX_LOCK(dtoa_mutex); if ((rv = freelist[k])) { freelist[k] = rv->next; } else { x = 1 << k; rv = (Bigint *)MALLOC(sizeof(Bigint) + (x-1)*sizeof(Long)); + if (!rv) { + _THREAD_PRIVATE_MUTEX_UNLOCK(dtoa_mutex); + zend_error(E_ERROR, "Balloc() failed to allocate memory"); + } rv->k = k; rv->maxwds = x; } |
