From: Cristy Date: Sat, 28 Apr 2018 19:16:35 +0000 (-0400) Subject: ... X-Git-Tag: 7.0.7-29~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f55c97eaa68765747652c25634b559738fd76d1b;p=imagemagick ... --- diff --git a/coders/png.c b/coders/png.c index 78d436caa..f70eed4ec 100644 --- a/coders/png.c +++ b/coders/png.c @@ -4989,11 +4989,19 @@ static Image *ReadOneJNGImage(MngInfo *mng_info, status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) { + DestroyJNG(NULL,&color_image,&color_image_info,&alpha_image, + &alpha_image_info); jng_image=DestroyImageList(jng_image); - DestroyJNG(NULL,NULL,NULL,&alpha_image,&alpha_image_info); return(DestroyImageList(image)); } - + if ((image->columns != jng_image->columns) || + (image->rows != jng_image->rows)) + { + DestroyJNG(NULL,&color_image,&color_image_info,&alpha_image, + &alpha_image_info); + jng_image=DestroyImageList(jng_image); + ThrowReaderException(CorruptImageError,"ImproperImageHeader"); + } for (y=0; y < (ssize_t) image->rows; y++) { s=GetVirtualPixels(jng_image,0,y,image->columns,1,exception);