From 3582a2b90b37548e17b759d3fc9d1f4b89be272a Mon Sep 17 00:00:00 2001 From: Cristy Date: Thu, 10 Aug 2017 08:38:46 -0400 Subject: [PATCH] ... --- MagickCore/memory.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/MagickCore/memory.c b/MagickCore/memory.c index 2713260f4..f839f6715 100644 --- a/MagickCore/memory.c +++ b/MagickCore/memory.c @@ -606,8 +606,6 @@ MagickExport MemoryInfo *AcquireVirtualMemory(const size_t count, value=DestroyString(value); } } - if ((count*quantum) > (size_t) max_memory_request) - return((MemoryInfo *) NULL); if (virtual_anonymous_memory == 0) { virtual_anonymous_memory=1; @@ -631,7 +629,8 @@ MagickExport MemoryInfo *AcquireVirtualMemory(const size_t count, extent=count*quantum; memory_info->length=extent; memory_info->signature=MagickCoreSignature; - if (virtual_anonymous_memory == 1) + if ((virtual_anonymous_memory == 1) && + ((count*quantum) <= (size_t) max_memory_request)) { memory_info->blob=AcquireAlignedMemory(1,extent); if (memory_info->blob != NULL) @@ -642,7 +641,9 @@ MagickExport MemoryInfo *AcquireVirtualMemory(const size_t count, /* Acquire anonymous memory map. */ - memory_info->blob=MapBlob(-1,IOMode,0,extent); + memory_info->blob=NULL; + if ((count*quantum) <= (size_t) max_memory_request) + memory_info->blob=MapBlob(-1,IOMode,0,extent); if (memory_info->blob != NULL) memory_info->type=MapVirtualMemory; else -- 2.40.0