diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2007-03-06 03:15:41 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2007-03-06 03:15:41 +0000 |
commit | 37da90248deb2188e8ee50e4753ad6340679b425 (patch) | |
tree | 9a03724efd1326e48c5f089ed962a95cd5bd720a /Zend/zend_strtod.c | |
parent | 896abc5e34d905879558f85ec93887154c3cdd95 (diff) | |
download | php-git-37da90248deb2188e8ee50e4753ad6340679b425.tar.gz |
Added missing allocation checks
Diffstat (limited to 'Zend/zend_strtod.c')
-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; } |