From: Cristy Date: Sat, 4 Nov 2017 14:55:48 +0000 (-0400) Subject: https://github.com/ImageMagick/ImageMagick/issues/85 X-Git-Tag: 7.0.7-10~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2130bf6f89ded32ef0c88a11694f107c52566c53;p=imagemagick https://github.com/ImageMagick/ImageMagick/issues/85 --- diff --git a/coders/wpg.c b/coders/wpg.c index 6fbfe4266..33c8b25a9 100644 --- a/coders/wpg.c +++ b/coders/wpg.c @@ -1050,7 +1050,9 @@ static Image *ReadWPGImage(const ImageInfo *image_info, WPG_Palette.StartIndex=ReadBlobLSBShort(image); WPG_Palette.NumOfEntries=ReadBlobLSBShort(image); if ((WPG_Palette.NumOfEntries-WPG_Palette.StartIndex) > - (Rec2.RecordLength-2-2) / 3) + (Rec2.RecordLength-2-2)/3) + ThrowReaderException(CorruptImageError,"InvalidColormapIndex"); + if (WPG_Palette.StartIndex > WPG_Palette.NumOfEntries) ThrowReaderException(CorruptImageError,"InvalidColormapIndex"); image->colors=WPG_Palette.NumOfEntries; if (!AcquireImageColormap(image,image->colors,exception))