File ImageMagick-CVE-2017-9501.patch of Package ImageMagick.8212

Index: ImageMagick-6.8.8-1/magick/image.c
===================================================================
--- ImageMagick-6.8.8-1.orig/magick/image.c	2017-06-30 18:21:06.494563833 +0200
+++ ImageMagick-6.8.8-1/magick/image.c	2017-06-30 18:22:59.536598458 +0200
@@ -821,9 +821,12 @@ MagickExport Image *CloneImage(const Ima
       clone_image->colors=image->colors;
       length=(size_t) image->colors;
       clone_image->colormap=(PixelPacket *) AcquireQuantumMemory(length,
-        sizeof(*clone_image->colormap));
+        sizeof(*clone_image->colormap)+1);
       if (clone_image->colormap == (PixelPacket *) NULL)
+      {
+        clone_image=(Image *) RelinquishMagickMemory(clone_image);
         ThrowImageException(ResourceLimitError,"MemoryAllocationFailed");
+      }
       (void) CopyMagickMemory(clone_image->colormap,image->colormap,length*
         sizeof(*clone_image->colormap));
     }