]> granicus.if.org Git - imagemagick/commitdiff
https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=30504
authorCristy <urban-warrior@imagemagick.org>
Tue, 20 Sep 2016 14:44:11 +0000 (10:44 -0400)
committerCristy <urban-warrior@imagemagick.org>
Tue, 20 Sep 2016 14:44:11 +0000 (10:44 -0400)
coders/wpg.c

index 4f221fd6bdc51b342f5da0953c616ed6988a711d..f647443501382278503904858f66069e3db2f2e0 100644 (file)
@@ -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);
             }
           {