]> granicus.if.org Git - imagemagick/commitdiff
https://github.com/ImageMagick/ImageMagick/issues/1757
authorCristy <urban-warrior@imagemagick.org>
Wed, 16 Oct 2019 23:36:32 +0000 (19:36 -0400)
committerCristy <urban-warrior@imagemagick.org>
Wed, 16 Oct 2019 23:36:32 +0000 (19:36 -0400)
coders/miff.c

index 56df00194d54eed61949020efc70c8f6217ce193..dd3a2f57c18390ecb2fd02c45a0ded7435a85f29 100644 (file)
@@ -222,6 +222,7 @@ static void PushRunlengthPacket(Image *image,const unsigned char *pixels,
       switch (image->depth)
       {
         case 32:
+        default:
         {
           pixel->index=(MagickRealType) ConstrainColormapIndex(image,(ssize_t)
             (((size_t) *p << 24) | ((size_t) *(p+1) << 16) |
@@ -243,9 +244,6 @@ static void PushRunlengthPacket(Image *image,const unsigned char *pixels,
           p++;
           break;
         }
-        default:
-          (void) ThrowMagickException(exception,GetMagickModule(),
-            CorruptImageError,"ImageDepthNotSupported","`%s'",image->filename);
       }
       switch (image->depth)
       {
@@ -275,6 +273,7 @@ static void PushRunlengthPacket(Image *image,const unsigned char *pixels,
           break;
         }
         case 32:
+        default:
         {
           unsigned int
             quantum;
@@ -287,9 +286,6 @@ static void PushRunlengthPacket(Image *image,const unsigned char *pixels,
             }
           break;
         }
-        default:
-          (void) ThrowMagickException(exception,GetMagickModule(),
-            CorruptImageError,"ImageDepthNotSupported","`%s'",image->filename);
       }
       *length=((size_t) *p++)+1;
       return;
@@ -358,6 +354,7 @@ static void PushRunlengthPacket(Image *image,const unsigned char *pixels,
       break;
     }
     case 32:
+    default:
     {
       unsigned int
         quantum;
@@ -390,9 +387,6 @@ static void PushRunlengthPacket(Image *image,const unsigned char *pixels,
         }
       break;
     }
-    default:
-      (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageError,
-        "ImageDepthNotSupported","`%s'",image->filename);
   }
   *length=(size_t) (*p++)+1;
 }
@@ -1121,7 +1115,7 @@ static Image *ReadMIFFImage(const ImageInfo *image_info,
         (image->compression == UndefinedCompression) ||
         (image->colorspace == UndefinedColorspace) ||
         (image->columns == 0) || (image->rows == 0) ||
-        (image->depth == 0) || (image->depth > 64))
+        (image->depth == 0) || (image->depth > 32))
       {
         if (profiles != (LinkedListInfo *) NULL)
           profiles=DestroyLinkedList(profiles,RelinquishMagickMemory);
@@ -1234,12 +1228,6 @@ static Image *ReadMIFFImage(const ImageInfo *image_info,
             p=colormap;
             switch (image->depth)
             {
-              default:
-              {
-                colormap=(unsigned char *) RelinquishMagickMemory(colormap);
-                ThrowMIFFException(CorruptImageError,"ImageDepthNotSupported");
-                break;
-              }
               case 8:
               {
                 unsigned char
@@ -1279,6 +1267,7 @@ static Image *ReadMIFFImage(const ImageInfo *image_info,
                 break;
               }
               case 32:
+              default:
               {
                 unsigned int
                   long_pixel;
@@ -1852,6 +1841,7 @@ static unsigned char *PopRunlengthPacket(Image *image,unsigned char *pixels,
       switch (image->depth)
       {
         case 32:
+        default:
         {
           *pixels++=(unsigned char) (value >> 24);
           *pixels++=(unsigned char) (value >> 16);
@@ -1863,13 +1853,11 @@ static unsigned char *PopRunlengthPacket(Image *image,unsigned char *pixels,
           *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;
@@ -1906,9 +1894,6 @@ static unsigned char *PopRunlengthPacket(Image *image,unsigned char *pixels,
             }
           break;
         }
-        default:
-          (void) ThrowMagickException(exception,GetMagickModule(),
-            CorruptImageError,"ImageDepthNotSupported","`%s'",image->filename);
       }
       *pixels++=(unsigned char) length;
       return(pixels);
@@ -1916,6 +1901,7 @@ static unsigned char *PopRunlengthPacket(Image *image,unsigned char *pixels,
   switch (image->depth)
   {
     case 32:
+    default:
     {
       unsigned int
         value;
@@ -1996,9 +1982,6 @@ static unsigned char *PopRunlengthPacket(Image *image,unsigned char *pixels,
         }
       break;
     }
-    default:
-      (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageError,
-        "ImageDepthNotSupported","`%s'",image->filename);
   }
   *pixels++=(unsigned char) length;
   return(pixels);
@@ -2092,8 +2075,7 @@ static MagickBooleanType WriteMIFFImage(const ImageInfo *image_info,
     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");
@@ -2452,9 +2434,8 @@ static MagickBooleanType WriteMIFFImage(const ImageInfo *image_info,
         {
           switch (quantum_info->depth)
           {
-            default:
-              ThrowWriterException(CorruptImageError,"ImageDepthNotSupported");
             case 32:
+            default:
             {
               register unsigned int
                 long_pixel;