File ImageMagick-CVE-2014-9841.patch of Package ImageMagick.8212

Index: ImageMagick-6.8.8-1/coders/psd.c
===================================================================
--- ImageMagick-6.8.8-1.orig/coders/psd.c	2016-06-15 14:21:22.554641802 +0200
+++ ImageMagick-6.8.8-1/coders/psd.c	2016-06-15 14:26:37.315775336 +0200
@@ -1197,7 +1197,7 @@ static MagickStatusType ReadPSDLayers(Im
       if ((count == 0) || (LocaleNCompare(type,"8BIM",4) != 0))
         {
           if (DiscardBlobBytes(image,size-quantum-8) == MagickFalse)
-            ThrowFileException(exception,CorruptImageError,
+            ThrowBinaryException(CorruptImageError,
               "UnexpectedEndOfFile",image->filename);
         }
       else
@@ -1207,7 +1207,7 @@ static MagickStatusType ReadPSDLayers(Im
             size=GetPSDSize(psd_info,image);
           else
             if (DiscardBlobBytes(image,size-quantum-12) == MagickFalse)
-              ThrowFileException(exception,CorruptImageError,
+              ThrowBinaryException(CorruptImageError,
                 "UnexpectedEndOfFile",image->filename);
         }
     }
@@ -1237,7 +1237,8 @@ static MagickStatusType ReadPSDLayers(Im
           "  image contains %.20g layers",(double) number_layers);
 
       if (number_layers == 0)
-        return(MagickFalse);
+        ThrowBinaryException(CorruptImageError,"InvalidNumberOfLayers",
+          image->filename);
 
       layer_info=(LayerInfo *) AcquireQuantumMemory((size_t) number_layers,
         sizeof(*layer_info));
@@ -1351,8 +1352,8 @@ static MagickStatusType ReadPSDLayers(Im
                 if (DiscardBlobBytes(image,length-16) == MagickFalse)
                   {
                     layer_info=DestroyLayerInfo(layer_info,number_layers);
-                    ThrowFileException(exception,CorruptImageError,
-                      "UnexpectedEndOfFile",image->filename);
+                    ThrowBinaryException(CorruptImageError,"UnexpectedEndOfFile",
+                      image->filename);
                   }
               }
             length=ReadBlobMSBLong(image);