]> granicus.if.org Git - imagemagick/commitdiff
Added check to avoid possible division by zero.
authorDirk Lemstra <dirk@git.imagemagick.org>
Sat, 13 Jan 2018 02:12:18 +0000 (03:12 +0100)
committerDirk Lemstra <dirk@git.imagemagick.org>
Sat, 13 Jan 2018 02:12:31 +0000 (03:12 +0100)
Credit to OSS-Fuzz

coders/sct.c

index e9c3d11581fed762518d6cdc966421420eca1cf1..d6e0dabb745d51447073573eb4e6f3d0d15c05f3 100644 (file)
@@ -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)