Skip to content

Commit 4e87854

Browse files
committed
Use HeapOverflowSanityCheckGetSize to make it more clear what is happening.
1 parent 7779f1f commit 4e87854

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

coders/sun.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,7 @@ static Image *ReadSUNImage(const ImageInfo *image_info,ExceptionInfo *exception)
319319
sun_info.maplength=ReadBlobMSBLong(image);
320320
if (sun_info.maplength > GetBlobSize(image))
321321
ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile");
322-
extent=(size_t) (sun_info.height*sun_info.width);
323-
if ((sun_info.height != 0) && (sun_info.width != (extent/sun_info.height)))
322+
if (HeapOverflowSanityCheckGetSize(sun_info.width,sun_info.height,&extent) != MagickFalse)
324323
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
325324
if ((sun_info.type != RT_STANDARD) && (sun_info.type != RT_ENCODED) &&
326325
(sun_info.type != RT_FORMAT_RGB))

0 commit comments

Comments
 (0)