From: Dirk Lemstra Date: Sat, 13 Jan 2018 02:12:18 +0000 (+0100) Subject: Added check to avoid possible division by zero. X-Git-Tag: 7.0.7-22~98 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fdde85132c7024c7c4817155213c631811b579be;p=imagemagick Added check to avoid possible division by zero. Credit to OSS-Fuzz --- diff --git a/coders/sct.c b/coders/sct.c index e9c3d1158..d6e0dabb7 100644 --- a/coders/sct.c +++ b/coders/sct.c @@ -214,6 +214,9 @@ static Image *ReadSCTImage(const ImageInfo *image_info,ExceptionInfo *exception) count=ReadBlob(image,768,buffer); if (separations_mask == 0x0f) SetImageColorspace(image,CMYKColorspace,exception); + if ((image->columns < 1) || (image->rows < 1) || + (width < MagickEpsilon) || (height < MagickEpsilon)) + ThrowReaderException(CorruptImageError,"ImproperImageHeader"); image->resolution.x=1.0*image->columns/width; image->resolution.y=1.0*image->rows/height; if (image_info->ping != MagickFalse)