]> granicus.if.org Git - imagemagick/commitdiff
https://github.com/ImageMagick/ImageMagick/issues/713
authorCristy <urban-warrior@imagemagick.org>
Fri, 1 Sep 2017 13:24:56 +0000 (09:24 -0400)
committerCristy <urban-warrior@imagemagick.org>
Fri, 1 Sep 2017 13:24:56 +0000 (09:24 -0400)
coders/txt.c

index 051f6bef2b22cbe80632c426621066104b4ebb06..93a5e76db8ac129806d2b6d29174b046c7f0d8d7 100644 (file)
@@ -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)