Permalink
Browse files

Ensure image extent does not exceed maximum

  • Loading branch information...
Cristy
Cristy committed May 16, 2016
1 parent ac72d94 commit fc43974d34318c834fbf78570ca1a3764ed8c7d7
Showing with 6 additions and 3 deletions.
  1. +6 −3 coders/wpg.c
View
@@ -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);

0 comments on commit fc43974

Please sign in to comment.