]> granicus.if.org Git - imagemagick/commitdiff
https://github.com/ImageMagick/ImageMagick/issues/1199
authorCristy <urban-warrior@imagemagick.org>
Thu, 5 Jul 2018 18:29:46 +0000 (14:29 -0400)
committerCristy <urban-warrior@imagemagick.org>
Thu, 5 Jul 2018 18:29:46 +0000 (14:29 -0400)
coders/cals.c
coders/dcm.c
coders/pict.c
coders/pwp.c

index 842cff4acc51e0f768309463ee2a2799866e9996..bce23e8212506ce375b327e774fed6659b17aecb 100644 (file)
@@ -257,7 +257,8 @@ static Image *ReadCALSImage(const ImageInfo *image_info,
   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 334fd2ec89879699773abd80bc79dcbd576988c3..49fe55a1928b8e0d1d1c610cf0fc38f770e033a7 100644 (file)
@@ -3228,13 +3228,13 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception)
               (strncmp(implicit_vr,"SS",2) == 0) ||
               (strncmp(implicit_vr,"US",2) == 0))
             quantum=2;
-          else 
+          else
             if ((strncmp(implicit_vr,"FL",2) == 0) ||
                 (strncmp(implicit_vr,"OF",2) == 0) ||
                 (strncmp(implicit_vr,"SL",2) == 0) ||
                 (strncmp(implicit_vr,"UL",2) == 0))
               quantum=4;
-            else 
+            else
               if (strncmp(implicit_vr,"FD",2) == 0)
                 quantum=8;
               else
@@ -3880,7 +3880,8 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception)
                   "UnexpectedEndOfFile",image->filename);
                 break;
               }
-            (void) fputc(c,file);
+            if (fputc(c,file) != c)
+              break;
           }
           (void) fclose(file);
           if (c == EOF)
@@ -3934,7 +3935,7 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception)
         length=(size_t) (GetQuantumRange(info.depth)+1);
         if (length > (size_t) GetBlobSize(image))
           ThrowDCMException(CorruptImageError,"InsufficientImageDataInFile");
-        if (info.scale != (Quantum *) NULL) 
+        if (info.scale != (Quantum *) NULL)
           info.scale=(Quantum *) RelinquishMagickMemory(info.scale);
         info.scale=(Quantum *) AcquireQuantumMemory(MagickMax(length,256),
           sizeof(*info.scale));
index 8aafadec26a2617535d7f7ec0168cfaa36fd038a..35dadfeee0fd3fe9bc1d7f557b759bfc8e249a54 100644 (file)
@@ -1472,7 +1472,8 @@ static Image *ReadPICTImage(const ImageInfo *image_info,
               c=ReadBlobByte(image);
               if (c == EOF)
                 break;
-              (void) fputc(c,file);
+              if (fputc(c,file) != c)
+                break;
             }
           }
         (void) fclose(file);
index e5ae5c8805133c4a23ba9540aeb40af0193a49a7..cad42500274563931a06f819261f0be2b33588d8 100644 (file)
@@ -233,7 +233,8 @@ static Image *ReadPWPImage(const ImageInfo *image_info,ExceptionInfo *exception)
       c=ReadBlobByte(pwp_image);
       if (c == EOF)
         break;
-      (void) fputc(c,file);
+      if (fputc(c,file) != c)
+        break;
     }
     (void) fclose(file);
     if (c == EOF)