From: cristy Date: Sat, 10 Jan 2015 14:10:16 +0000 (+0000) Subject: http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=26857 X-Git-Tag: 7.0.1-0~1462 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b8f17d08b7418204bf8a05a5c24e87b2fc395b75;p=imagemagick http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=26857 --- diff --git a/coders/sun.c b/coders/sun.c index af1a7289b..728bffa4d 100644 --- a/coders/sun.c +++ b/coders/sun.c @@ -409,8 +409,8 @@ static Image *ReadSUNImage(const ImageInfo *image_info,ExceptionInfo *exception) sun_info.length || !sun_info.length) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); number_pixels=(MagickSizeType) image->columns*image->rows; - if ((sun_info.type != RT_ENCODED) && (sun_info.depth >= 8) && - ((number_pixels*((sun_info.depth+7)/8)) > sun_info.length)) + if ((sun_info.type != RT_ENCODED) && + ((number_pixels*sun_info.depth) > (8*sun_info.length))) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); bytes_per_line=sun_info.width*sun_info.depth; sun_data=(unsigned char *) AcquireQuantumMemory((size_t) MagickMax( @@ -532,7 +532,7 @@ static Image *ReadSUNImage(const ImageInfo *image_info,ExceptionInfo *exception) bytes_per_pixel++; if (bytes_per_line == 0) bytes_per_line=bytes_per_pixel*image->columns; - length=image->rows*(bytes_per_line+image->columns % 2); + length=image->rows*(bytes_per_line+bytes_per_line % 2); if (((sun_info.type == RT_ENCODED) && (length > (bytes_per_line*image->rows))) || ((sun_info.type != RT_ENCODED) && (length > sun_info.length)))