From: Dirk Lemstra Date: Sat, 28 Apr 2018 12:51:11 +0000 (+0200) Subject: Added missing check for image_type (https://oss-fuzz.com/v2/testcase-detail/497396249... X-Git-Tag: 7.0.7-29~25 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6ae5c12bdf36b29587e25c958837a999341047ad;p=imagemagick Added missing check for image_type (https://oss-fuzz.com/v2/testcase-detail/4973962497884160). --- diff --git a/coders/xcf.c b/coders/xcf.c index e619a935e..b0d2887a0 100644 --- a/coders/xcf.c +++ b/coders/xcf.c @@ -1098,14 +1098,14 @@ static Image *ReadXCFImage(const ImageInfo *image_info,ExceptionInfo *exception) status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) return(DestroyImageList(image)); + if (image_type == GIMP_INDEXED) + ThrowReaderException(CoderError,"ColormapTypeNotSupported"); if (image_type == GIMP_RGB) SetImageColorspace(image,sRGBColorspace,exception); + else if (image_type == GIMP_GRAY) + SetImageColorspace(image,GRAYColorspace,exception); else - if (image_type == GIMP_GRAY) - SetImageColorspace(image,GRAYColorspace,exception); - else - if (image_type == GIMP_INDEXED) - ThrowReaderException(CoderError,"ColormapTypeNotSupported"); + ThrowReaderException(CorruptImageError,"ImproperImageHeader"); (void) SetImageBackgroundColor(image,exception); (void) SetImageAlpha(image,OpaqueAlpha,exception); /*