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

Index: ImageMagick-7.0.7-34/coders/cals.c
===================================================================
--- ImageMagick-7.0.7-34.orig/coders/cals.c	2018-05-20 17:55:43.000000000 +0200
+++ ImageMagick-7.0.7-34/coders/cals.c	2018-09-10 16:11:02.712169398 +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-7.0.7-34/coders/dcm.c
===================================================================
--- ImageMagick-7.0.7-34.orig/coders/dcm.c	2018-09-10 16:11:02.716169419 +0200
+++ ImageMagick-7.0.7-34/coders/dcm.c	2018-09-10 16:19:45.766884393 +0200
@@ -3863,7 +3863,8 @@ static Image *ReadDCMImage(const ImageIn
                 "UnexpectedEndOfFile",image->filename);
               break;
             }
-          (void) fputc(c,file);
+            if (fputc(c,file) != c)
+              break;
         }
         (void) fclose(file);
         if (c == EOF)
Index: ImageMagick-7.0.7-34/coders/pict.c
===================================================================
--- ImageMagick-7.0.7-34.orig/coders/pict.c	2018-09-10 16:11:02.704169358 +0200
+++ ImageMagick-7.0.7-34/coders/pict.c	2018-09-10 16:11:02.716169419 +0200
@@ -1493,7 +1493,8 @@ static Image *ReadPICTImage(const ImageI
               c=ReadBlobByte(image);
               if (c == EOF)
                 break;
-              (void) fputc(c,file);
+              if (fputc(c,file) != c)
+                break;
             }
           }
         (void) fclose(file);
Index: ImageMagick-7.0.7-34/coders/pwp.c
===================================================================
--- ImageMagick-7.0.7-34.orig/coders/pwp.c	2018-05-20 17:55:43.000000000 +0200
+++ ImageMagick-7.0.7-34/coders/pwp.c	2018-09-10 16:11:02.716169419 +0200
@@ -233,7 +233,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