From 1f30ce48a3cc192bc67b083136910f238db5794f Mon Sep 17 00:00:00 2001 From: cristy Date: Thu, 4 Dec 2014 00:59:05 +0000 Subject: [PATCH] --- coders/sun.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/coders/sun.c b/coders/sun.c index a00d16c1c..86ec0bc12 100644 --- a/coders/sun.c +++ b/coders/sun.c @@ -534,8 +534,9 @@ static Image *ReadSUNImage(const ImageInfo *image_info,ExceptionInfo *exception) bytes_per_pixel=3; if (image->alpha_trait == BlendPixelTrait) bytes_per_pixel++; - length=image->rows*((bytes_per_line*image->columns)+ - image->columns % 2); + if (bytes_per_line == 0) + bytes_per_line=bytes_per_pixel*image->columns; + length=image->rows*(bytes_per_line+image->columns % 2); if (((sun_info.type == RT_ENCODED) && (length > (bytes_per_line*image->rows))) || ((sun_info.type != RT_ENCODED) && (length > sun_info.length))) -- 2.40.0