com php-src: Fixed overflow check: Zend/zend_arena.h
| From: | Dmitry Stogov | Date: | Fri, 05 Sep 2014 12:13:06 +0000 |
| Subject: | com php-src: Fixed overflow check: Zend/zend_arena.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-81440@lists.php.net to get a copy of this message | ||
Commit: 7d0416f4018103f95c4f06daabe60769310ffa6e
Author: Dmitry Stogov <dmitry@zend.com> Fri, 5 Sep 2014 16:13:06 +0400
Parents: 828fe353817c78cec2ceb7c42ff0644069f46ba7
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7d0416f4018103f95c4f06daabe60769310ffa6e
Log:
Fixed overflow check
Changed paths:
M Zend/zend_arena.h
Diff:
diff --git a/Zend/zend_arena.h b/Zend/zend_arena.h
index 12c5db6..8988eb4 100644
--- a/Zend/zend_arena.h
+++ b/Zend/zend_arena.h
@@ -80,10 +80,13 @@ static zend_always_inline void* zend_arena_alloc(zend_arena **arena_ptr, size_t
static zend_always_inline void* zend_arena_calloc(zend_arena **arena_ptr, size_t count, size_t
unit_size)
{
- size_t size = unit_size * count;
+ zend_long overflow;
+ double d;
+ size_t size;
void *ret;
- ZEND_ASSERT(size >= unit_size && size >= count);
+ ZEND_SIGNED_MULTIPLY_LONG(unit_size, count, size, d, overflow);
+ ZEND_ASSERT(overflow == 0);
ret = zend_arena_alloc(arena_ptr, size);
memset(ret, 0, size);
return ret;