]> granicus.if.org Git - imagemagick/commitdiff
Added extra check that was reported in #466.
authorDirk Lemstra <dirk@git.imagemagick.org>
Wed, 3 May 2017 21:58:25 +0000 (23:58 +0200)
committerDirk Lemstra <dirk@git.imagemagick.org>
Wed, 3 May 2017 21:58:25 +0000 (23:58 +0200)
coders/icon.c

index 5e854d0cb47e8d117b3725784fd388540b91fd61..67883b166f962862c917951a957dc650aa60de39 100644 (file)
@@ -432,7 +432,7 @@ static Image *ReadICONImage(const ImageInfo *image_info,
         {
           image->storage_class=PseudoClass;
           image->colors=icon_info.number_colors;
-          if (image->colors == 0)
+          if ((image->colors == 0) || (image->colors > 256))
             image->colors=one << icon_info.bits_per_pixel;
         }
       if (image->storage_class == PseudoClass)