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

Index: ImageMagick-6.8.8-1/coders/pcd.c
===================================================================
--- ImageMagick-6.8.8-1.orig/coders/pcd.c	2013-12-01 15:47:50.000000000 +0100
+++ ImageMagick-6.8.8-1/coders/pcd.c	2017-05-11 11:02:26.951081331 +0200
@@ -544,7 +544,10 @@ static Image *ReadPCDImage(const ImageIn
   overview=LocaleNCompare((char *) header,"PCD_OPA",7) == 0;
   if ((count == 0) ||
       ((LocaleNCompare((char *) header+0x800,"PCD",3) != 0) && (overview == 0)))
+  {
+    header=(unsigned char *) RelinquishMagickMemory(header);
     ThrowReaderException(CorruptImageError,"ImproperImageHeader");
+  }
   rotate=header[0x0e02] & 0x03;
   number_images=(header[10] << 8) | header[11];
   header=(unsigned char *) RelinquishMagickMemory(header);