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

--- a/coders/png.c
+++ b/coders/png.c
@@ -5252,7 +5252,11 @@ static Image *ReadOneMNGImage(MngInfo* mng_info, const ImageInfo *image_info,
             mng_info->dhdr_warning++;
           }
         if (memcmp(type,mng_MEND,4) == 0)
-          break;
+          {
+            if (length != 0)
+              chunk=(unsigned char *) RelinquishMagickMemory(chunk);
+            break;
+          }
 
         if (skip_to_iend)
           {