From: Cristy Date: Fri, 24 Nov 2017 01:43:39 +0000 (-0500) Subject: Check for negative resources X-Git-Tag: 7.0.7-12~35 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=83c98befd999677dbd9d58aa89d4cb609c5c0f7c;p=imagemagick Check for negative resources --- diff --git a/MagickCore/resource.c b/MagickCore/resource.c index a65c5a328..642502a2d 100644 --- a/MagickCore/resource.c +++ b/MagickCore/resource.c @@ -210,7 +210,7 @@ MagickExport MagickBooleanType AcquireMagickResource(const ResourceType type, resource_info.memory+=(MagickOffsetType) size; limit=resource_info.memory_limit; if ((limit == MagickResourceInfinity) || - ((MagickSizeType) resource_info.memory < limit)) + (resource_info.memory < (MagickOffsetType) limit)) status=MagickTrue; else resource_info.memory-=(MagickOffsetType) size; @@ -230,7 +230,7 @@ MagickExport MagickBooleanType AcquireMagickResource(const ResourceType type, resource_info.map+=(MagickOffsetType) size; limit=resource_info.map_limit; if ((limit == MagickResourceInfinity) || - ((MagickSizeType) resource_info.map < limit)) + (resource_info.map < (MagickOffsetType) limit)) status=MagickTrue; else resource_info.map-=(MagickOffsetType) size; @@ -250,7 +250,7 @@ MagickExport MagickBooleanType AcquireMagickResource(const ResourceType type, resource_info.disk+=(MagickOffsetType) size; limit=resource_info.disk_limit; if ((limit == MagickResourceInfinity) || - ((MagickSizeType) resource_info.disk < limit)) + (resource_info.disk < (MagickOffsetType) limit)) status=MagickTrue; else resource_info.disk-=(MagickOffsetType) size; @@ -270,7 +270,7 @@ MagickExport MagickBooleanType AcquireMagickResource(const ResourceType type, resource_info.file+=(MagickOffsetType) size; limit=resource_info.file_limit; if ((limit == MagickResourceInfinity) || - ((MagickSizeType) resource_info.file < limit)) + (resource_info.file < (MagickOffsetType) limit)) status=MagickTrue; else resource_info.file-=(MagickOffsetType) size; @@ -307,7 +307,7 @@ MagickExport MagickBooleanType AcquireMagickResource(const ResourceType type, { limit=resource_info.thread_limit; if ((limit == MagickResourceInfinity) || - ((MagickSizeType) resource_info.thread < limit)) + (resource_info.thread < (MagickOffsetType) limit)) status=MagickTrue; if (logging != MagickFalse) { @@ -325,7 +325,7 @@ MagickExport MagickBooleanType AcquireMagickResource(const ResourceType type, { limit=resource_info.throttle_limit; if ((limit == MagickResourceInfinity) || - ((MagickSizeType) resource_info.throttle < limit)) + (resource_info.throttle < (MagickOffsetType) limit)) status=MagickTrue; if (logging != MagickFalse) { @@ -344,7 +344,7 @@ MagickExport MagickBooleanType AcquireMagickResource(const ResourceType type, resource_info.time+=(MagickOffsetType) size; limit=resource_info.time_limit; if ((limit == MagickResourceInfinity) || - ((MagickSizeType) resource_info.time < limit)) + (resource_info.time < (MagickOffsetType) limit)) status=MagickTrue; else resource_info.time-=(MagickOffsetType) size;