File ImageMagick-CVE-2017-11505,11526.patch of Package ImageMagick.15344
Index: ImageMagick-6.8.8-1/coders/png.c
===================================================================
--- ImageMagick-6.8.8-1.orig/coders/png.c 2018-01-12 11:18:25.106246195 +0100
+++ ImageMagick-6.8.8-1/coders/png.c 2018-01-12 11:18:46.010592674 +0100
@@ -4262,7 +4262,15 @@ static Image *ReadOneJNGImage(MngInfo *m
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
for (i=0; i < (ssize_t) length; i++)
- chunk[i]=(unsigned char) ReadBlobByte(image);
+ {
+ int
+ c;
+
+ c=ReadBlobByte(image);
+ if (c == EOF)
+ break;
+ chunk[i]=(unsigned char) c;
+ }
p=chunk;
}
@@ -5134,7 +5142,15 @@ static Image *ReadOneMNGImage(MngInfo* m
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
for (i=0; i < (ssize_t) length; i++)
- chunk[i]=(unsigned char) ReadBlobByte(image);
+ {
+ int
+ c;
+
+ c=ReadBlobByte(image);
+ if (c == EOF)
+ break;
+ chunk[i]=(unsigned char) c;
+ }
p=chunk;
}