Blob Blame History Raw
diff -up ImageMagick-6.7.8-9/coders/icon.c.icon-mem ImageMagick-6.7.8-9/coders/icon.c
--- ImageMagick-6.7.8-9/coders/icon.c.icon-mem	2012-07-17 21:11:28.000000000 +0200
+++ ImageMagick-6.7.8-9/coders/icon.c	2016-06-02 16:18:24.366200378 +0200
@@ -277,6 +277,8 @@ static Image *ReadICONImage(const ImageI
           Icon image encoded as a compressed PNG image.
         */
         length=icon_file.directory[i].size;
+        if (~length < 16)
+          ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
         png=(unsigned char *) AcquireQuantumMemory(length+16,sizeof(*png));
         if (png == (unsigned char *) NULL)
           ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");