From: Cristy Date: Fri, 1 Sep 2017 13:24:56 +0000 (-0400) Subject: https://github.com/ImageMagick/ImageMagick/issues/713 X-Git-Tag: 7.0.7-0~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fdd11d04a87ca92649b8a598dbdb1d4b676fc25d;p=imagemagick https://github.com/ImageMagick/ImageMagick/issues/713 --- diff --git a/coders/txt.c b/coders/txt.c index 051f6bef2..93a5e76db 100644 --- a/coders/txt.c +++ b/coders/txt.c @@ -446,9 +446,9 @@ static Image *ReadTXTImage(const ImageInfo *image_info,ExceptionInfo *exception) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); image->columns=width; image->rows=height; - for (depth=1; (GetQuantumRange(depth)+1) < max_value; depth++) - if (depth >= 64) - break; + if ((max_value == 0) || (max_value > 4294967295)) + ThrowReaderException(CorruptImageError,"ImproperImageHeader"); + for (depth=1; (GetQuantumRange(depth)+1) < max_value; depth++) ; image->depth=depth; status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse)