Skip to content

Commit e8a2735

Browse files
author
Cristy
committed
fix scrambled image @ #5291
1 parent e32bd1d commit e8a2735

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

coders/mac.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,16 @@ static Image *ReadMACImage(const ImageInfo *image_info,ExceptionInfo *exception)
139139
length=ReadBlobLSBShort(image);
140140
if ((length & 0xff) != 0)
141141
ThrowReaderException(CorruptImageError,"CorruptImage");
142-
for (x=0; x < (ssize_t) 638; x++)
143-
if (ReadBlobByte(image) == EOF)
144-
ThrowReaderException(CorruptImageError,"CorruptImage");
142+
if (length == 0)
143+
{
144+
for (x=0; x < (ssize_t) 510; x++)
145+
if (ReadBlobByte(image) == EOF)
146+
ThrowReaderException(CorruptImageError,"CorruptImage");
147+
}
148+
else
149+
for (x=0; x < (ssize_t) 638; x++)
150+
if (ReadBlobByte(image) == EOF)
151+
ThrowReaderException(CorruptImageError,"CorruptImage");
145152
image->columns=576;
146153
image->rows=720;
147154
image->depth=1;

0 commit comments

Comments
 (0)