File ImageMagick-CVE-2017-12674.patch of Package ImageMagick.8212

--- a/coders/pdb.c
+++ b/coders/pdb.c
@@ -572,7 +572,15 @@ static Image *ReadPDBImage(const ImageInfo *image_info,ExceptionInfo *exception)
         length;
 
       num_pad_bytes = (size_t) (comment_offset - TellBlob( image ));
-      while (num_pad_bytes--) ReadBlobByte( image );
+      while (num_pad_bytes-- != 0)
+      {
+        int
+          c;
+
+        c=ReadBlobByte(image);
+        if (c == EOF)
+          break;
+      }
 
       /*
         Read comment.