Added missing check for image_type (https://oss-fuzz.com/v2/testcase-detail/497396249...
authorDirk Lemstra <dirk@git.imagemagick.org>
Sat, 28 Apr 2018 12:51:11 +0000 (14:51 +0200)
committerDirk Lemstra <dirk@git.imagemagick.org>
Sat, 28 Apr 2018 12:51:11 +0000 (14:51 +0200)
coders/xcf.c

index e619a935e8a111ee40d9512b5c8c7788a5921fa3..b0d2887a0be3a4de4bb3d9a632a195a642c8f97d 100644 (file)
@@ -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);
   /*