]> granicus.if.org Git - imagemagick/commitdiff
Added extra checks to force an early exit.
authorDirk Lemstra <dirk@git.imagemagick.org>
Fri, 16 Mar 2018 11:06:03 +0000 (12:06 +0100)
committerDirk Lemstra <dirk@git.imagemagick.org>
Fri, 16 Mar 2018 11:06:03 +0000 (12:06 +0100)
coders/pict.c

index 67972026f674d54a829ecb5f2b3327db46e83c10..017866c7b9d573f849d7d3112ed261b677e5e0cd 100644 (file)
@@ -500,7 +500,7 @@ static unsigned char *DecodeImage(Image *blob,Image *image,
       scanline_length=ReadBlobMSBShort(blob);
     else
       scanline_length=1UL*ReadBlobByte(blob);
-    if (scanline_length >= row_bytes)
+    if ((scanline_length >= row_bytes) || (scanline_length == 0))
       {
         (void) ThrowMagickException(exception,GetMagickModule(),
           CorruptImageError,"UnableToUncompressImage","`%s'",image->filename);
@@ -945,6 +945,8 @@ static Image *ReadPICTImage(const ImageInfo *image_info,
       code=ReadBlobMSBSignedShort(image);
     if (code < 0)
       break;
+    if (code == 0)
+      continue;
     if (code > 0xa1)
       {
         if (image->debug != MagickFalse)