File ImageMagick-CVE-2020-27753.patch of Package ImageMagick.30356

Index: ImageMagick-7.0.7-34/coders/miff.c
===================================================================
--- ImageMagick-7.0.7-34.orig/coders/miff.c	2020-12-09 21:42:48.437202197 +0100
+++ ImageMagick-7.0.7-34/coders/miff.c	2020-12-09 21:45:58.918491192 +0100
@@ -212,6 +212,7 @@ static void PushRunlengthPacket(Image *i
       switch (image->depth)
       {
         case 32:
+        default:
         {
           pixel->index=(MagickRealType) ConstrainColormapIndex(image,(ssize_t)
             (((size_t) *p << 24) | ((size_t) *(p+1) << 16) |
@@ -233,9 +234,6 @@ static void PushRunlengthPacket(Image *i
           p++;
           break;
         }
-        default:
-          (void) ThrowMagickException(exception,GetMagickModule(),
-            CorruptImageError,"ImageDepthNotSupported","`%s'",image->filename);
       }
       switch (image->depth)
       {
@@ -265,6 +263,7 @@ static void PushRunlengthPacket(Image *i
           break;
         }
         case 32:
+        default:
         {
           unsigned int
             quantum;
@@ -277,9 +276,6 @@ static void PushRunlengthPacket(Image *i
             }
           break;
         }
-        default:
-          (void) ThrowMagickException(exception,GetMagickModule(),
-            CorruptImageError,"ImageDepthNotSupported","`%s'",image->filename);
       }
       *length=(size_t) (*p++)+1;
       return;
@@ -348,6 +344,7 @@ static void PushRunlengthPacket(Image *i
       break;
     }
     case 32:
+    default:
     {
       unsigned int
         quantum;
@@ -380,9 +377,6 @@ static void PushRunlengthPacket(Image *i
         }
       break;
     }
-    default:
-      (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageError,
-        "ImageDepthNotSupported","`%s'",image->filename);
   }
   *length=(size_t) (*p++)+1;
 }
@@ -1220,9 +1214,6 @@ static Image *ReadMIFFImage(const ImageI
             p=colormap;
             switch (image->depth)
             {
-              default:
-                colormap=(unsigned char *) RelinquishMagickMemory(colormap);
-                ThrowMIFFException(CorruptImageError,"ImageDepthNotSupported");
               case 8:
               {
                 unsigned char
@@ -1262,6 +1253,7 @@ static Image *ReadMIFFImage(const ImageI
                 break;
               }
               case 32:
+              default:
               {
                 unsigned int
                   long_pixel;
@@ -1827,6 +1819,7 @@ static unsigned char *PopRunlengthPacket
       switch (image->depth)
       {
         case 32:
+        default:
         {
           *pixels++=(unsigned char) (value >> 24);
           *pixels++=(unsigned char) (value >> 16);
@@ -1838,13 +1831,11 @@ static unsigned char *PopRunlengthPacket
           *pixels++=(unsigned char) value;
           break;
         }
-        default:
-          (void) ThrowMagickException(exception,GetMagickModule(),
-            CorruptImageError,"ImageDepthNotSupported","`%s'",image->filename);
       }
       switch (image->depth)
       {
         case 32:
+        default:
         {
           unsigned int
             long_value;
@@ -1881,9 +1872,6 @@ static unsigned char *PopRunlengthPacket
             }
           break;
         }
-        default:
-          (void) ThrowMagickException(exception,GetMagickModule(),
-            CorruptImageError,"ImageDepthNotSupported","`%s'",image->filename);
       }
       *pixels++=(unsigned char) length;
       return(pixels);
@@ -1891,6 +1879,7 @@ static unsigned char *PopRunlengthPacket
   switch (image->depth)
   {
     case 32:
+    default:
     {
       unsigned int
         value;
@@ -1971,9 +1960,6 @@ static unsigned char *PopRunlengthPacket
         }
       break;
     }
-    default:
-      (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageError,
-        "ImageDepthNotSupported","`%s'",image->filename);
   }
   *pixels++=(unsigned char) length;
   return(pixels);
@@ -2067,8 +2053,7 @@ static MagickBooleanType WriteMIFFImage(
     if ((image->storage_class == PseudoClass) &&
         (image->colors > (size_t) (GetQuantumRange(image->depth)+1)))
       (void) SetImageStorageClass(image,DirectClass,exception);
-    image->depth=image->depth <= 8 ? 8UL : image->depth <= 16 ? 16UL :
-      image->depth <= 32 ? 32UL : 64UL;
+    image->depth=image->depth <= 8 ? 8UL : image->depth <= 16 ? 16UL : 32UL;
     quantum_info=AcquireQuantumInfo(image_info,image);
     if (quantum_info == (QuantumInfo *) NULL)
       ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
@@ -2427,12 +2412,8 @@ static MagickBooleanType WriteMIFFImage(
         {
           switch (quantum_info->depth)
           {
-            default:
-            {
-              colormap=(unsigned char *) RelinquishMagickMemory(colormap);
-              ThrowWriterException(CorruptImageError,"ImageDepthNotSupported");
-            }
             case 32:
+            default:
             {
               register unsigned int
                 long_pixel;
openSUSE Build Service is sponsored by