]> granicus.if.org Git - imagemagick/commitdiff
https://github.com/ImageMagick/ImageMagick/issues/196
authorCristy <urban-warrior@imagemagick.org>
Sat, 4 Jun 2016 00:18:07 +0000 (20:18 -0400)
committerCristy <urban-warrior@imagemagick.org>
Sat, 4 Jun 2016 00:18:07 +0000 (20:18 -0400)
coders/tiff.c

index d051e1e666555a57f3122797b2617730cbd47b73..fa589d94f6eecaabc0c66fa62bfb0d0d0563716b 100644 (file)
@@ -390,8 +390,10 @@ static Image *ReadGROUP4Image(const ImageInfo *image_info,
   length=fwrite("\000\000\000\000",1,4,file);
   length=WriteLSBLong(file,(long) image->resolution.x);
   length=WriteLSBLong(file,1);
+  status=MagickTrue;
   for (length=0; (c=ReadBlobByte(image)) != EOF; length++)
-    (void) fputc(c,file);
+    if (fputc(c,file) != c)
+      status=MagickFalse;
   offset=(ssize_t) fseek(file,(ssize_t) offset,SEEK_SET);
   length=WriteLSBLong(file,(unsigned int) length);
   (void) fclose(file);
@@ -413,6 +415,8 @@ static Image *ReadGROUP4Image(const ImageInfo *image_info,
       (void) CopyMagickString(image->magick,"GROUP4",MagickPathExtent);
     }
   (void) RelinquishUniqueFileResource(filename);
+  if (status == MagickFalse)
+    image=DestroyImage(image);
   return(image);
 }
 #endif