From c2c1622f05d9b94444c8d5fe07aa378fe18269a8 Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Fri, 16 Mar 2018 12:06:03 +0100 Subject: [PATCH] Added extra checks to force an early exit. --- coders/pict.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/coders/pict.c b/coders/pict.c index 67972026f..017866c7b 100644 --- a/coders/pict.c +++ b/coders/pict.c @@ -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) -- 2.40.0