File GraphicsMagick-CVE-2017-14994.patch of Package GraphicsMagick.7782

diff -r 0683f8724200 -r b3eca3eaa264 coders/dcm.c
--- a/coders/dcm.c	Sun Oct 01 15:43:56 2017 -0500
+++ b/coders/dcm.c	Sun Oct 01 16:10:26 2017 -0500
@@ -4852,10 +4852,21 @@
     MagickFreeMemory(dcm.rescale_map);
   if (status == MagickPass)
     {
-      while (image->previous != (Image *) NULL)
-        image=image->previous;
-      CloseBlob(image);
-      return(image);
+      /* It is possible to have success status yet have no image */
+      if (image != (Image *) NULL)
+        {
+          while (image->previous != (Image *) NULL)
+            image=image->previous;
+          CloseBlob(image);
+          return(image);
+        }
+      else
+        {
+          ThrowException(exception,CorruptImageError,
+                         ImageFileDoesNotContainAnyImageData,
+                         image_info->filename);
+          return (Image *) NULL;
+        }
     }
   else
     {

openSUSE Build Service is sponsored by