]> granicus.if.org Git - imagemagick/commitdiff
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6880
authorCristy <urban-warrior@imagemagick.org>
Thu, 15 Mar 2018 00:56:35 +0000 (20:56 -0400)
committerCristy <urban-warrior@imagemagick.org>
Thu, 15 Mar 2018 00:56:35 +0000 (20:56 -0400)
coders/wpg.c

index d179f7e49c9a5486ecb5d0dc64d6a986cc14042a..44749f9457699695bd976df7f46b3b9064d83d62 100644 (file)
@@ -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,