From 6ae5c12bdf36b29587e25c958837a999341047ad Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Sat, 28 Apr 2018 14:51:11 +0200 Subject: [PATCH] Added missing check for image_type (https://oss-fuzz.com/v2/testcase-detail/4973962497884160). --- coders/xcf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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); /* -- 2.40.0