From f55c97eaa68765747652c25634b559738fd76d1b Mon Sep 17 00:00:00 2001 From: Cristy Date: Sat, 28 Apr 2018 15:16:35 -0400 Subject: [PATCH] ... --- coders/png.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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); -- 2.40.0