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

From ca0c886abd6d3ef335eb74150cd23b89ebd17135 Mon Sep 17 00:00:00 2001
From: Cristy <urban-warrior@imagemagick.org>
Date: Sun, 24 Jan 2016 17:42:22 -0500
Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/99

---
 coders/viff.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: ImageMagick-6.8.8-1/coders/viff.c
===================================================================
--- ImageMagick-6.8.8-1.orig/coders/viff.c	2016-09-27 12:03:36.991152862 +0200
+++ ImageMagick-6.8.8-1/coders/viff.c	2016-09-27 12:03:53.803427616 +0200
@@ -69,6 +69,14 @@
 /*
   Forward declarations.
 */
+static inline size_t MagickMax(const size_t x,const size_t y)
+{
+  if (x > y)
+    return(x);
+  return(y);
+}
+
+
 static MagickBooleanType
   WriteVIFFImage(const ImageInfo *,Image *);
 
@@ -492,8 +500,8 @@ static Image *ReadVIFFImage(const ImageI
       max_packets=((image->columns+7UL) >> 3UL)*image->rows;
     else
       max_packets=(size_t) (number_pixels*viff_info.number_data_bands);
-    pixels=(unsigned char *) AcquireQuantumMemory(max_packets,
-      bytes_per_pixel*sizeof(*pixels));
+    pixels=(unsigned char *) AcquireQuantumMemory(MagickMax(number_pixels,
+      max_packets),bytes_per_pixel*sizeof(*pixels));
     if (pixels == (unsigned char *) NULL)
       ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
     count=ReadBlob(image,bytes_per_pixel*max_packets,pixels);