com php-src: Fixed zero-size allocation in debug build: Zend/zend_alloc.c
| From: | Dmitry Stogov | Date: | Tue, 26 Aug 2014 17:32:20 +0000 |
| Subject: | com php-src: Fixed zero-size allocation in debug build: Zend/zend_alloc.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-81127@lists.php.net to get a copy of this message | ||
Commit: cb37fe1aae9470659e67ca5286168883bef43f35
Author: Dmitry Stogov <dmitry@zend.com> Tue, 26 Aug 2014 21:32:20 +0400
Parents: d285e346daad8b630c71cd599493825e66056181
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=cb37fe1aae9470659e67ca5286168883bef43f35
Log:
Fixed zero-size allocation in debug build
Changed paths:
M Zend/zend_alloc.c
Diff:
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index 7d7a481..805cc85 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -1169,6 +1169,8 @@ static zend_always_inline void *zend_mm_alloc_heap(zend_mm_heap *heap, size_t
si
size_t real_size = size;
zend_mm_debug_info *dbg;
+ /* special handling for zero-size allocation */
+ size = MAX(size, 1);
size = ZEND_MM_ALIGNED_SIZE(size) + ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_debug_info));
#endif
if (size <= ZEND_MM_MAX_SMALL_SIZE) {