Re: com php-src: Fixed bug #73370: NEWS Zend/zend_alloc.c
| From: | Matt Wilmas | Date: | Fri, 10 Mar 2017 09:06:12 +0000 |
| Subject: | Re: com php-src: Fixed bug #73370: NEWS Zend/zend_alloc.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-97280@lists.php.net to get a copy of this message | ||
Hi Nikita,
----- Original Message -----
From: "Nikita Popov"
Sent: Thursday, March 09, 2017
Subject: [PHP-CVS] com php-src: Fixed bug #73370: NEWS Zend/zend_alloc.c
This closes bug #73928 as well...?Commit: 177f87cf052179d22bab008aa13c69d4b0cdc0ef Author: Nikita Popov <nikita.ppv@gmail.com> Thu, 9 Mar 2017 20:47:06 +0100Parents: 247ce052cd0fc7d0d8ea1a0e7ea2075e9601766a Branches: PHP-7.0 PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=177f87cf052179d22bab008aa13c69d4b0cdc0ef Log: Fixed bug #73370 If len=0 malloc() is allowed to return NULL. Bugs: https://bugs.php.net/73370
Changed paths: M NEWS M Zend/zend_alloc.c Diff: diff --git a/NEWS b/NEWS index a5fdf55..820d908 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2017 PHP 7.0.18 +- Core: + . Fixed bug #73370 (falsely exits with "Out of Memory" when using+ USE_ZEND_ALLOC=0). (Nikita)+ - Date: . Fixed bug #72096 (Swatch time value incorrect for dates before 1970). (mcq8) diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 14cc0d5..48def78 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -2862,7 +2862,7 @@ static ZEND_COLD ZEND_NORETURN void zend_out_of_memory(void) ZEND_API void * __zend_malloc(size_t len) { void *tmp = malloc(len); - if (EXPECTED(tmp)) { + if (EXPECTED(tmp || !len)) { return tmp; } zend_out_of_memory(); @@ -2878,7 +2878,7 @@ ZEND_API void * __zend_calloc(size_t nmemb, size_t len) ZEND_API void * __zend_realloc(void *p, size_t len) { p = realloc(p, len); - if (EXPECTED(p)) { + if (EXPECTED(p || !len)) { return p; } zend_out_of_memory();