From: cristy Date: Sat, 12 Sep 2009 04:01:09 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~10718 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=93b13ba5e97c22fe01401531b9c6aeec493288ba;p=imagemagick --- diff --git a/coders/gray.c b/coders/gray.c index 9b7535bcd..110f02657 100644 --- a/coders/gray.c +++ b/coders/gray.c @@ -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); /*