From: Cristy Date: Sun, 10 Sep 2017 15:03:51 +0000 (-0400) Subject: Throw exception if cache nexus width or height are zero X-Git-Tag: 7.0.7-2~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ba214881e6af74cdb5edb2ae9f8ca8eedf9fa60e;p=imagemagick Throw exception if cache nexus width or height are zero --- diff --git a/MagickCore/cache.c b/MagickCore/cache.c index dc7187bf0..8b5a91fb4 100644 --- a/MagickCore/cache.c +++ b/MagickCore/cache.c @@ -4802,7 +4802,13 @@ static Quantum *SetPixelCacheNexusPixels(const CacheInfo *cache_info, assert(cache_info->signature == MagickCoreSignature); if (cache_info->type == UndefinedCache) return((Quantum *) NULL); + if ((region->width == 0) || (region->height == 0)) + return((Quantum *) NULL); nexus_info->region=(*region); + number_pixels=(MagickSizeType) nexus_info->region.width* + nexus_info->region.height; + if (number_pixels == 0) + return((Quantum *) NULL); if ((cache_info->type == MemoryCache) || (cache_info->type == MapCache)) { ssize_t @@ -4840,8 +4846,6 @@ static Quantum *SetPixelCacheNexusPixels(const CacheInfo *cache_info, /* Pixels are stored in a staging region until they are synced to the cache. */ - number_pixels=(MagickSizeType) nexus_info->region.width* - nexus_info->region.height; length=number_pixels*cache_info->number_channels*sizeof(Quantum); if (cache_info->metacontent_extent != 0) length+=number_pixels*cache_info->metacontent_extent;