]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sat, 12 Sep 2009 04:01:09 +0000 (04:01 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sat, 12 Sep 2009 04:01:09 +0000 (04:01 +0000)
coders/gray.c

index 9b7535bcd02ebd41ed3d5258fcc1d82834ae3f1b..110f02657ca7f959c5930a29cc31a8327a049d94 100644 (file)
@@ -196,12 +196,6 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
       {
         length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
         count=ReadBlob(image,length,pixels);
-        if (count != (ssize_t) length)
-          {
-            ThrowFileException(exception,CorruptImageError,
-              "UnexpectedEndOfFile",image->filename);
-            break;
-          }
       }
     for (y=0; y < (long) image->extract_info.height; y++)
     {
@@ -214,6 +208,12 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
       register PixelPacket
         *__restrict q;
 
+      if (count != (ssize_t) length)
+        {
+          ThrowFileException(exception,CorruptImageError,
+            "UnexpectedEndOfFile",image->filename);
+          break;
+        }
       q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,exception);
       if (q == (PixelPacket *) NULL)
         break;
@@ -221,14 +221,6 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
         quantum_type,pixels,exception);
       if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
         break;
-      count=ReadBlob(image,length,pixels);
-      if ((count != (ssize_t) length) &&
-          (y < (long) (image->extract_info.height-1)))
-        {
-          ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
-            image->filename);
-          break;
-        }
       if (((y-image->extract_info.y) >= 0) && 
           ((y-image->extract_info.y) < (long) image->rows))
         {
@@ -255,6 +247,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
           if (status == MagickFalse)
             break;
         }
+      count=ReadBlob(image,length,pixels);
     }
     SetQuantumImageType(image,quantum_type);
     /*