From: Cristy Date: Mon, 19 Mar 2018 10:44:05 +0000 (-0400) Subject: ... X-Git-Tag: 7.0.7-28~69 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a358a77aa1ded0cb95b06f7d10e16ac1f0e013af;p=imagemagick ... --- diff --git a/coders/dib.c b/coders/dib.c index 8d1a72c43..f6399bf20 100644 --- a/coders/dib.c +++ b/coders/dib.c @@ -190,6 +190,9 @@ static MagickBooleanType DecodeImage(Image *image, q=pixels+number_pixels; for (y=0; y < (ssize_t) image->rows; ) { + MagickBooleanType + status; + if ((p < pixels) || (p >= q)) break; count=ReadBlobByte(image); @@ -197,10 +200,10 @@ static MagickBooleanType DecodeImage(Image *image, break; if (count > 0) { - count=(int) MagickMin((size_t) count,(size_t) (q-p)); /* Encoded mode. */ + count=(int) MagickMin((size_t) count,(size_t) (q-p)); byte=ReadBlobByte(image); if (byte == EOF) break; @@ -223,6 +226,8 @@ static MagickBooleanType DecodeImage(Image *image, Escape mode. */ count=ReadBlobByte(image); + if (count == EOF) + break; if (count == 0x01) return(MagickTrue); switch (count) @@ -291,12 +296,14 @@ static MagickBooleanType DecodeImage(Image *image, } } } - if (SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,image->rows) == MagickFalse) + status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, + image->rows); + if (status == MagickFalse) break; } (void) ReadBlobByte(image); /* end of line */ (void) ReadBlobByte(image); - return(MagickTrue); + return(y < (ssize_t) image->rows ? MagickFalse : MagickTrue); } /*