Skip to content
Permalink
Browse files Browse the repository at this point in the history
Ensure image extent does not exceed maximum
  • Loading branch information
Cristy committed May 16, 2016
1 parent ac72d94 commit fc43974
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions coders/wpg.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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))
{
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit fc43974

Please sign in to comment.