summaryrefslogtreecommitdiff
path: root/Zend/zend_strtod.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2007-03-06 03:15:41 +0000
committerIlia Alshanetsky <iliaa@php.net>2007-03-06 03:15:41 +0000
commit37da90248deb2188e8ee50e4753ad6340679b425 (patch)
tree9a03724efd1326e48c5f089ed962a95cd5bd720a /Zend/zend_strtod.c
parent896abc5e34d905879558f85ec93887154c3cdd95 (diff)
downloadphp-git-37da90248deb2188e8ee50e4753ad6340679b425.tar.gz
Added missing allocation checks
Diffstat (limited to 'Zend/zend_strtod.c')
-rw-r--r--Zend/zend_strtod.c8
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;
}