]> granicus.if.org Git - imagemagick/commitdiff
https://github.com/ImageMagick/ImageMagick/issues/956
authorCristy <urban-warrior@imagemagick.org>
Fri, 9 Feb 2018 00:43:26 +0000 (19:43 -0500)
committerCristy <urban-warrior@imagemagick.org>
Fri, 9 Feb 2018 00:43:46 +0000 (19:43 -0500)
coders/sun.c

index b36a9ea23182cc3fc2bf71c79b2eb71e6de065d8..fe6277de99226f4464d2d9a904cbdca9fbcd0ccf 100644 (file)
@@ -344,6 +344,8 @@ static Image *ReadSUNImage(const ImageInfo *image_info,ExceptionInfo *exception)
           image->colors=one << sun_info.depth;
         if (sun_info.maptype == RMT_EQUAL_RGB)
           image->colors=sun_info.maplength/3;
+        if (image->colors == 0)
+          ThrowReaderException(CorruptImageError,"ImproperImageHeader");
         if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)
           ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
       }