From fc25040471ee40b11c5bdecb3b2efd5457c54022 Mon Sep 17 00:00:00 2001 From: Cristy Date: Wed, 14 Mar 2018 20:56:35 -0400 Subject: [PATCH] https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6880 --- coders/wpg.c | 2 ++ 1 file changed, 2 insertions(+) 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, -- 2.40.0