]> granicus.if.org Git - imagemagick/commitdiff
Added checks for depth.
authordirk <dirk@git.imagemagick.org>
Fri, 15 Jan 2016 01:11:22 +0000 (02:11 +0100)
committerdirk <dirk@git.imagemagick.org>
Fri, 15 Jan 2016 01:11:22 +0000 (02:11 +0100)
coders/sun.c

index 303ed18d3595bfe9b14ceb30a3e0d5787b98a164..4158d4c617ea87fc710375037a62e359fa0f0a1a 100644 (file)
@@ -313,7 +313,8 @@ static Image *ReadSUNImage(const ImageInfo *image_info,ExceptionInfo *exception)
       ThrowReaderException(CorruptImageError,"ImproperImageHeader");
     if ((sun_info.maptype == RMT_NONE) && (sun_info.maplength != 0))
       ThrowReaderException(CorruptImageError,"ImproperImageHeader");
-    if ((sun_info.depth == 0) || (sun_info.depth > 32))
+    if ((sun_info.depth != 1) && (sun_info.depth != 8) &&
+        (sun_info.depth != 16) && (sun_info.depth != 32))
       ThrowReaderException(CorruptImageError,"ImproperImageHeader");
     if ((sun_info.maptype != RMT_NONE) && (sun_info.maptype != RMT_EQUAL_RGB) &&
         (sun_info.maptype != RMT_RAW))