File ImageMagick-CVE-2019-12975.patch of Package ImageMagick.30356

Index: ImageMagick-7.0.7-34/coders/dpx.c
===================================================================
--- ImageMagick-7.0.7-34.orig/coders/dpx.c	2018-05-20 17:55:43.000000000 +0200
+++ ImageMagick-7.0.7-34/coders/dpx.c	2019-07-18 15:39:30.032864913 +0200
@@ -2016,11 +2016,16 @@ static MagickBooleanType WriteDPXImage(c
   pixels=(unsigned char *) GetQuantumPixels(quantum_info);
   for (y=0; y < (ssize_t) image->rows; y++)
   {
+    size_t
+      length;
+
     p=GetVirtualPixels(image,0,y,image->columns,1,exception);
     if (p == (const Quantum *) NULL)
       break;
-    (void) ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
+    length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
       quantum_type,pixels,exception);
+    if (length == 0)
+      break;
     count=WriteBlob(image,extent,pixels);
     if (count != (ssize_t) extent)
       break;
@@ -2030,6 +2035,8 @@ static MagickBooleanType WriteDPXImage(c
       break;
   }
   quantum_info=DestroyQuantumInfo(quantum_info);
+  if (y < (ssize_t) image->rows)
+    ThrowWriterException(CorruptImageError,"UnableToWriteImageData");
   (void) CloseBlob(image);
   return(status);
 }
openSUSE Build Service is sponsored by