File ImageMagick-CVE-2018-16643.patch of Package ImageMagick.8831

Index: ImageMagick-6.8.8-1/coders/cals.c
===================================================================
--- ImageMagick-6.8.8-1.orig/coders/cals.c	2018-09-10 16:30:12.906028093 +0200
+++ ImageMagick-6.8.8-1/coders/cals.c	2018-09-10 16:30:14.326035085 +0200
@@ -257,7 +257,8 @@ static Image *ReadCALSImage(const ImageI
   if ((unique_file == -1) || (file == (FILE *) NULL))
     ThrowImageException(FileOpenError,"UnableToCreateTemporaryFile");
   while ((c=ReadBlobByte(image)) != EOF)
-    (void) fputc(c,file);
+    if (fputc(c,file) != c)
+      break;
   (void) fclose(file);
   (void) CloseBlob(image);
   image=DestroyImage(image);
Index: ImageMagick-6.8.8-1/coders/dcm.c
===================================================================
--- ImageMagick-6.8.8-1.orig/coders/dcm.c	2018-09-10 16:30:14.314035026 +0200
+++ ImageMagick-6.8.8-1/coders/dcm.c	2018-09-10 16:30:14.326035085 +0200
@@ -3625,7 +3625,8 @@ static Image *ReadDCMImage(const ImageIn
                 "UnexpectedEndOfFile",image->filename);
               break;
             }
-          (void) fputc(c,file);
+            if (fputc(c,file) != c)
+              break;
         }
         (void) fclose(file);
         (void) FormatLocaleString(read_info->filename,MaxTextExtent,
Index: ImageMagick-6.8.8-1/coders/pict.c
===================================================================
--- ImageMagick-6.8.8-1.orig/coders/pict.c	2018-09-10 16:30:14.330035106 +0200
+++ ImageMagick-6.8.8-1/coders/pict.c	2018-09-10 16:30:24.142083421 +0200
@@ -1454,7 +1454,8 @@ static Image *ReadPICTImage(const ImageI
         for (i=0; i < (ssize_t) (length-154); i++)
         {
           c=ReadBlobByte(image);
-          (void) fputc(c,file);
+          if (fputc(c,file) != c)
+                break;
         }
         (void) fclose(file);
         tile_image=ReadImage(read_info,exception);
Index: ImageMagick-6.8.8-1/coders/pwp.c
===================================================================
--- ImageMagick-6.8.8-1.orig/coders/pwp.c	2018-09-10 16:30:13.426030653 +0200
+++ ImageMagick-6.8.8-1/coders/pwp.c	2018-09-10 16:30:14.330035106 +0200
@@ -226,7 +226,8 @@ static Image *ReadPWPImage(const ImageIn
       c=ReadBlobByte(pwp_image);
       if (c == EOF)
         break;
-      (void) fputc(c,file);
+      if (fputc(c,file) != c)
+        break;
     }
     (void) fclose(file);
     if (c == EOF)
openSUSE Build Service is sponsored by