From 284cc352cee41a2df151a7f1a1caa63a5ae7abed Mon Sep 17 00:00:00 2001 From: Cristy Date: Sat, 13 Oct 2018 11:05:36 -0400 Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/1347 --- coders/pcx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/coders/pcx.c b/coders/pcx.c index f277950e3..b6177c258 100644 --- a/coders/pcx.c +++ b/coders/pcx.c @@ -983,7 +983,11 @@ static MagickBooleanType WritePCXImage(const ImageInfo *image_info,Image *image, } length=(((size_t) image->columns*pcx_info.bits_per_pixel+7)/8); if (length > 65535UL) - ThrowWriterException(ImageError,"WidthOrHeightExceedsLimit"); + { + if (page_table != (MagickOffsetType *) NULL) + page_table=(MagickOffsetType *) RelinquishMagickMemory(page_table); + ThrowWriterException(ImageError,"WidthOrHeightExceedsLimit"); + } pcx_info.bytes_per_line=(unsigned short) length; pcx_info.palette_info=1; pcx_info.colormap_signature=0x0c; -- 2.40.0