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

diff --git a/coders/wpg.c b/coders/wpg.c
index a53c17f2cc..ecd0a71503 100644
--- a/coders/wpg.c
+++ b/coders/wpg.c
@@ -1045,6 +1045,8 @@ static Image *ReadWPGImage(const ImageInfo *image_info,
           if(i==EOF)
             break;
           Rd_WP_DWORD(image,&Rec.RecordLength);
+          if (Rec.RecordLength > GetBlobSize(image))
+            ThrowReaderException(CorruptImageError,"ImproperImageHeader");
           if(EOFBlob(image))
             break;