tony2001 Thu Jun 12 12:40:07 2008 UTC Modified files: /php-src/ext/spl spl_fastarray.c Log: avoid invalid reads when reached memory_limit during initialization http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_fastarray.c?r1=1.6&r2=1.7&diff_format=u Index: php-src/ext/spl/spl_fastarray.c diff -u php-src/ext/spl/spl_fastarray.c:1.6 php-src/ext/spl/spl_fastarray.c:1.7 --- php-src/ext/spl/spl_fastarray.c:1.6 Mon Jun 9 17:29:09 2008 +++ php-src/ext/spl/spl_fastarray.c Thu Jun 12 12:40:07 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_fastarray.c,v 1.6 2008/06/09 17:29:09 colder Exp $ */ +/* $Id: spl_fastarray.c,v 1.7 2008/06/12 12:40:07 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -75,6 +75,7 @@ static void spl_fastarray_init(spl_fastarray *array, long size TSRMLS_DC) /* {{{ */ { if (size > 0) { + array->size = 0; /* reset size in case ecalloc() fails */ array->elements = ecalloc(size, sizeof(zval *)); array->size = size; } else { @@ -198,7 +199,7 @@ } } - if (intern->array->elements) { + if (intern->array->size > 0 && intern->array->elements) { efree(intern->array->elements); } efree(intern->array);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php