File ImageMagick-CVE-2017-8357.patch of Package ImageMagick.openSUSE_Leap_42.3_Update

From d340012f201619d57bc418e21b8569403f9453f1 Mon Sep 17 00:00:00 2001
From: Cristy <urban-warrior@imagemagick.org>
Date: Wed, 26 Apr 2017 17:39:11 -0400
Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/453

---
 coders/ept.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

Index: ImageMagick-6.8.8-1/coders/ept.c
===================================================================
--- ImageMagick-6.8.8-1.orig/coders/ept.c	2017-05-09 13:09:52.440127730 +0200
+++ ImageMagick-6.8.8-1/coders/ept.c	2017-05-09 13:13:16.495537985 +0200
@@ -211,19 +211,33 @@ static Image *ReadEPTImage(const ImageIn
   ept_info.tiff=(unsigned char *) AcquireQuantumMemory(ept_info.tiff_length+1,
     sizeof(*ept_info.tiff));
   if (ept_info.tiff == (unsigned char *) NULL)
-    ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+    {
+      ept_info.postscript=(unsigned char *) RelinquishMagickMemory(
+        ept_info.postscript);
+      ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+    }
   (void) ResetMagickMemory(ept_info.tiff,0,(ept_info.tiff_length+1)*
     sizeof(*ept_info.tiff));
   offset=SeekBlob(image,ept_info.tiff_offset,SEEK_SET);
   if (offset < 0)
-    ThrowReaderException(CorruptImageError,"ImproperImageHeader");
+    {
+      ept_info.tiff=(unsigned char *) RelinquishMagickMemory(ept_info.tiff);
+      ept_info.postscript=(unsigned char *) RelinquishMagickMemory(
+        ept_info.postscript);
+      ThrowReaderException(CorruptImageError,"ImproperImageHeader");
+    }
   count=ReadBlob(image,ept_info.tiff_length,ept_info.tiff);
   if (count != (ssize_t) (ept_info.tiff_length))
     (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageWarning,
       "InsufficientImageDataInFile","`%s'",image->filename);
   offset=SeekBlob(image,ept_info.postscript_offset,SEEK_SET);
   if (offset < 0)
-    ThrowReaderException(CorruptImageError,"ImproperImageHeader");
+    {
+      ept_info.tiff=(unsigned char *) RelinquishMagickMemory(ept_info.tiff);
+      ept_info.postscript=(unsigned char *) RelinquishMagickMemory(
+        ept_info.postscript);
+      ThrowReaderException(CorruptImageError,"ImproperImageHeader");
+    }
   count=ReadBlob(image,ept_info.postscript_length,ept_info.postscript);
   if (count != (ssize_t) (ept_info.postscript_length))
     (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageWarning,
openSUSE Build Service is sponsored by