From: Cristy Date: Thu, 20 Jun 2019 14:10:40 +0000 (-0400) Subject: https://github.com/ImageMagick/ImageMagick/issues/1607 X-Git-Tag: 7.0.8-50~24 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9b1854cbd2f96b4893943102a474f0668e63987f;p=imagemagick https://github.com/ImageMagick/ImageMagick/issues/1607 --- diff --git a/coders/pcx.c b/coders/pcx.c index a8cbd5797..600603c69 100644 --- a/coders/pcx.c +++ b/coders/pcx.c @@ -914,8 +914,6 @@ static MagickBooleanType WritePCXImage(const ImageInfo *image_info,Image *image, status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception); if (status == MagickFalse) return(status); - if ((image->columns > 65535UL) || (image->rows > 65535UL)) - ThrowWriterException(ImageError,"WidthOrHeightExceedsLimit"); page_table=(MagickOffsetType *) NULL; if ((LocaleCompare(image_info->magick,"DCX") == 0) || ((GetNextImageInList(image) != (Image *) NULL) && @@ -982,7 +980,8 @@ static MagickBooleanType WritePCXImage(const ImageInfo *image_info,Image *image, pcx_info.planes++; } length=(((size_t) image->columns*pcx_info.bits_per_pixel+7)/8); - if (length > 65535UL) + if ((image->columns > 65535UL) || (image->rows > 65535UL) || + (length > 65535UL)) { if (page_table != (MagickOffsetType *) NULL) page_table=(MagickOffsetType *) RelinquishMagickMemory(page_table);