]> granicus.if.org Git - imagemagick/commitdiff
Ensure image extent does not exceed maximum
authorCristy <urban-warrior@imagemagick.org>
Mon, 16 May 2016 18:00:14 +0000 (14:00 -0400)
committerCristy <urban-warrior@imagemagick.org>
Mon, 16 May 2016 18:00:14 +0000 (14:00 -0400)
coders/wpg.c

index b6ba8d79fe376284d37220638ceb0e63e79d11d6..0dfdc47f0b31d6588a6a6a1477f78de32e7191ca 100644 (file)
@@ -1112,6 +1112,9 @@ static Image *ReadWPGImage(const ImageInfo *image_info,
               bpp=BitmapHeader2.Depth;
 
             UnpackRaster:      
+              status=SetImageExtent(image,image->columns,image->rows,exception);
+              if (status == MagickFalse)
+                break;
               if ((image->colors == 0) && (bpp != 24))
                 {
                   image->colors=one << bpp;
@@ -1305,6 +1308,9 @@ static Image *ReadWPGImage(const ImageInfo *image_info,
                 }
               image->columns=Bitmap2Header1.Width;
               image->rows=Bitmap2Header1.Height;
+              status=SetImageExtent(image,image->columns,image->rows,exception);
+              if (status == MagickFalse)
+                break;
 
               if ((image->colors == 0) && (bpp != 24))
                 {
@@ -1423,9 +1429,6 @@ static Image *ReadWPGImage(const ImageInfo *image_info,
          ThrowReaderException(CoderError,"DataEncodingSchemeIsNotSupported");
       }
    }
-  status=SetImageExtent(image,image->columns,image->rows,exception);
-  if (status == MagickFalse)
-    return(DestroyImageList(image));
 
  Finish:
   (void) CloseBlob(image);