From ed7f8237a8dc5eda6d3b85501f15ef36b4ff92c6 Mon Sep 17 00:00:00 2001 From: Cristy Date: Sun, 11 Feb 2018 11:11:14 -0500 Subject: [PATCH] https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6223 --- MagickCore/cache.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/MagickCore/cache.c b/MagickCore/cache.c index 1b030a0d3..9602a4a08 100644 --- a/MagickCore/cache.c +++ b/MagickCore/cache.c @@ -1580,9 +1580,6 @@ static Cache GetImagePixelCache(Image *image,const MagickBooleanType clone, destroy, status; - MagickSizeType - length; - static MagickSizeType cache_timelimit = MagickResourceInfinity, cpu_throttle = MagickResourceInfinity, @@ -1609,13 +1606,6 @@ static Cache GetImagePixelCache(Image *image,const MagickBooleanType clone, #endif ThrowFatalException(ResourceLimitFatalError,"TimeLimitExceeded"); } - length=GetImageListLength(image); - if (AcquireMagickResource(ListLengthResource,length) == MagickFalse) - { - (void) ThrowMagickException(exception,GetMagickModule(), - ResourceLimitError,"ListLengthExceedsLimit","`%s'",image->filename); - return((Cache) NULL); - } LockSemaphoreInfo(image->semaphore); assert(image->cache != (Cache) NULL); cache_info=(CacheInfo *) image->cache; @@ -3499,6 +3489,10 @@ static MagickBooleanType OpenPixelCache(Image *image,const MapMode mode, (AcquireMagickResource(HeightResource,image->rows) == MagickFalse)) ThrowBinaryException(ImageError,"WidthOrHeightExceedsLimit", image->filename); + length=GetImageListLength(image); + if (AcquireMagickResource(ListLengthResource,length) == MagickFalse) + ThrowBinaryException(ResourceLimitError,"ListLengthExceedsLimit", + image->filename); source_info=(*cache_info); source_info.file=(-1); (void) FormatLocaleString(cache_info->filename,MagickPathExtent,"%s[%.20g]", -- 2.40.0