From: Cristy Date: Tue, 20 Sep 2016 14:44:11 +0000 (-0400) Subject: https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=30504 X-Git-Tag: 7.0.3-1~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e13e029984cc210dfab35025870a407e37c4b37f;p=imagemagick https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=30504 --- diff --git a/coders/wpg.c b/coders/wpg.c index 4f221fd6b..f64744350 100644 --- a/coders/wpg.c +++ b/coders/wpg.c @@ -589,9 +589,15 @@ static int UnpackWPG2Raster(Image *image,int bpp,ExceptionInfo *exception) case 0x7D: SampleSize=ReadBlobByte(image); /* DSZ */ if(SampleSize>8) - return(-2); + { + BImgBuff=(unsigned char *) RelinquishMagickMemory(BImgBuff); + return(-2); + } if(SampleSize<1) - return(-2); + { + BImgBuff=(unsigned char *) RelinquishMagickMemory(BImgBuff); + return(-2); + } break; case 0x7E: (void) FormatLocaleFile(stderr, @@ -624,6 +630,7 @@ static int UnpackWPG2Raster(Image *image,int bpp,ExceptionInfo *exception) (void) FormatLocaleFile(stderr, "\nUnsupported WPG2 unaligned token RST x=%.20g, please report!\n" ,(double) x); + BImgBuff=(unsigned char *) RelinquishMagickMemory(BImgBuff); return(-3); } {