summaryrefslogtreecommitdiff
path: root/Zend/zend_alloc.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-08-26 10:27:08 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-08-26 10:27:08 +0200
commitbad49e55b94863153e890ff00d093e3a74627984 (patch)
tree2e5e03a7735d12b2c65576ee9121832e4618f503 /Zend/zend_alloc.c
parentc810d3d6ad978047a4f74da260f3157e11938ffa (diff)
parenta26f63213d29b85bf44e22163ddb0b735623617f (diff)
downloadphp-git-bad49e55b94863153e890ff00d093e3a74627984.tar.gz
Merge branch 'PHP-7.3' into PHP-7.4
Diffstat (limited to 'Zend/zend_alloc.c')
-rw-r--r--Zend/zend_alloc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index 618a66a9ea..21dc9073e5 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -939,7 +939,7 @@ get_chunk:
heap->cached_chunks = chunk->next;
} else {
#if ZEND_MM_LIMIT
- if (UNEXPECTED(heap->real_size + ZEND_MM_CHUNK_SIZE > heap->limit)) {
+ if (UNEXPECTED(ZEND_MM_CHUNK_SIZE > heap->limit - heap->real_size)) {
if (zend_mm_gc(heap)) {
goto get_chunk;
} else if (heap->overflow == 0) {
@@ -1465,8 +1465,8 @@ static zend_never_inline void *zend_mm_realloc_huge(zend_mm_heap *heap, void *pt
}
} else /* if (new_size > old_size) */ {
#if ZEND_MM_LIMIT
- if (UNEXPECTED(heap->real_size + (new_size - old_size) > heap->limit)) {
- if (zend_mm_gc(heap) && heap->real_size + (new_size - old_size) <= heap->limit) {
+ if (UNEXPECTED(new_size - old_size > heap->limit - heap->real_size)) {
+ if (zend_mm_gc(heap) && new_size - old_size <= heap->limit - heap->real_size) {
/* pass */
} else if (heap->overflow == 0) {
#if ZEND_DEBUG
@@ -1752,8 +1752,8 @@ static void *zend_mm_alloc_huge(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_D
void *ptr;
#if ZEND_MM_LIMIT
- if (UNEXPECTED(heap->real_size + new_size > heap->limit)) {
- if (zend_mm_gc(heap) && heap->real_size + new_size <= heap->limit) {
+ if (UNEXPECTED(new_size > heap->limit - heap->real_size)) {
+ if (zend_mm_gc(heap) && new_size <= heap->limit - heap->real_size) {
/* pass */
} else if (heap->overflow == 0) {
#if ZEND_DEBUG