File ImageMagick-CVE-2018-16749.patch of Package ImageMagick.23974
diff --git a/coders/png.c b/coders/png.c
index 31c0b8450..3d6eb7db2 100644
--- a/coders/png.c
+++ b/coders/png.c
@@ -4584,7 +4584,7 @@ static Image *ReadOneJNGImage(MngInfo *mng_info,
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Copying JDAT chunk data to color_blob.");
- if (length != 0)
+ if ((length != 0) && (color_image != (Image *) NULL))
{
(void) WriteBlob(color_image,length,chunk);
chunk=(unsigned char *) RelinquishMagickMemory(chunk);