File GraphicsMagick-CVE-2017-12140,12644.patch of Package GraphicsMagick.7893

Index: GraphicsMagick-1.3.25/coders/dcm.c
===================================================================
--- GraphicsMagick-1.3.25.orig/coders/dcm.c	2017-12-05 09:41:13.311162417 +0100
+++ GraphicsMagick-1.3.25/coders/dcm.c	2017-12-05 09:46:31.660442808 +0100
@@ -3646,6 +3646,11 @@ static MagickPassFail DCM_ReadElement(Im
       size_t
         size;
 
+      if (dcm->length > GetBlobSize(image))
+        {
+          ThrowException(exception,CorruptImageError,InsufficientImageDataInFile,image->filename);
+          return MagickFail;
+        }
       if (dcm->length > ((~0UL)/dcm->quantum))
         {
           ThrowException(exception,CorruptImageError,ImproperImageHeader,image->filename);
openSUSE Build Service is sponsored by