File ImageMagick-CVE-2016-7522.patch of Package ImageMagick.8212

From 4b1b9c0522628887195bad3a6723f7000b0c9a58 Mon Sep 17 00:00:00 2001
From: dirk <dirk@git.imagemagick.org>
Date: Tue, 2 Feb 2016 21:15:13 +0100
Subject: [PATCH] Added extra check to fix
 https://github.com/ImageMagick/ImageMagick/issues/93

---
 coders/psd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/coders/psd.c b/coders/psd.c
index 9f69d8a..47c6bcf 100644
--- a/coders/psd.c
+++ b/coders/psd.c
@@ -1936,7 +1936,7 @@ static Image *ReadPSDImage(const ImageInfo *image_info,ExceptionInfo *exception)
       if (blocks == (unsigned char *) NULL)
         ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
       count=ReadBlob(image,(size_t) length,blocks);
-      if ((count != (ssize_t) length) ||
+      if ((count != (ssize_t) length) || (length < 4) ||
           (LocaleNCompare((char *) blocks,"8BIM",4) != 0))
         {
           blocks=(unsigned char *) RelinquishMagickMemory(blocks);