From: Dmitry Stogov Date: Tue, 26 Aug 2014 17:32:20 +0000 (+0400) Subject: Fixed zero-size allocation in debug build X-Git-Tag: PRE_PHP7_REMOVALS~299 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cb37fe1aae9470659e67ca5286168883bef43f35;p=php Fixed zero-size allocation in debug build --- diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 7d7a481c80..805cc856bf 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) {