diff --git a/magick/memory-private.h b/magick/memory-private.h index 17666f2da..61dd3cef2 100644 --- a/magick/memory-private.h +++ b/magick/memory-private.h @@ -62,7 +62,8 @@ extern MagickPrivate MagickBooleanType extern MagickPrivate void ResetMaxMemoryRequest(void), - ResetVirtualAnonymousMemory(void); + ResetVirtualAnonymousMemory(void), + SetMaxMemoryRequest(const MagickSizeType); #if defined(__cplusplus) || defined(c_plusplus) } diff --git a/magick/memory.c b/magick/memory.c index 92d43759f..794822b72 100644 --- a/magick/memory.c +++ b/magick/memory.c @@ -1563,6 +1563,33 @@ MagickExport void SetMagickMemoryMethods( % % % % % % ++ S e t M a x M e m o r y R e q u e s t % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% SetMaxMemoryRequest() sets the max_memory_request value. +% +% The format of the ResetMaxMemoryRequest method is: +% +% void SetMaxMemoryRequest(const MagickSizeType limit) +% +% A description of each parameter follows: +% +% o limit: the maximum memory request limit. +% +*/ +MagickPrivate void SetMaxMemoryRequest(const MagickSizeType limit) +{ + max_memory_request=MagickMin(limit,GetMaxMemoryRequest()); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % % S h r e d F i l e % % % % % diff --git a/magick/policy.c b/magick/policy.c index 8da219479..ab0516975 100644 --- a/magick/policy.c +++ b/magick/policy.c @@ -1275,7 +1275,13 @@ static MagickBooleanType SetMagickSecurityPolicyValue(const PolicyDomain domain, { if (LocaleCompare(name,"max-memory-request") == 0) { - ResetMaxMemoryRequest(); + MagickSizeType + limit; + + limit=MagickResourceInfinity; + if (LocaleCompare("unlimited",value) != 0) + limit=StringToMagickSizeType(value,100.0); + SetMaxMemoryRequest(limit); return(MagickTrue); } if (LocaleCompare(name,"memory-map") == 0)