From: Cristy Date: Thu, 15 Mar 2018 00:56:35 +0000 (-0400) Subject: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6880 X-Git-Tag: 7.0.7-27~50 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fc25040471ee40b11c5bdecb3b2efd5457c54022;p=imagemagick https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6880 --- diff --git a/coders/wpg.c b/coders/wpg.c index d179f7e49..44749f945 100644 --- a/coders/wpg.c +++ b/coders/wpg.c @@ -1329,6 +1329,8 @@ static Image *ReadWPGImage(const ImageInfo *image_info, if ((WPG_Palette.NumOfEntries-WPG_Palette.StartIndex) > (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) == MagickFalse) ThrowReaderException(ResourceLimitError,