From e6f80026e5638eb4815ca848086c6b4da748611f Mon Sep 17 00:00:00 2001
From: cristy <cristy@aa41f4f7-0bf4-0310-aa73-e5a19afd5a74>
Date: Sun, 18 May 2014 12:46:09 +0000
Subject: [PATCH] Do not crash in case of corrupted pict image

git-svn-id: https://subversion.imagemagick.org/subversion/ImageMagick/branches/ImageMagick-6@15769 aa41f4f7-0bf4-0310-aa73-e5a19afd5a74
origin: http://trac.imagemagick.org/changeset/15769
---
 coders/pict.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/coders/pict.c b/coders/pict.c
index f7038ee..f1985e0 100644
--- a/coders/pict.c
+++ b/coders/pict.c
@@ -910,6 +910,8 @@ static Image *ReadPICTImage(const ImageInfo *image_info,
       code=ReadBlobByte(image);
     if (version == 2)
       code=(int) ReadBlobMSBShort(image);
+    if (code < 0)
+      break;
     if (code > 0xa1)
       {
         if (image->debug != MagickFalse)
-- 
2.1.4

