File ImageMagick-CVE-2017-8765.patch of Package ImageMagick.8212

diff --git a/coders/icon.c b/coders/icon.c
index 075d569..031f9de 100644
--- a/coders/icon.c
+++ b/coders/icon.c
@@ -438,7 +438,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)