From: Cristy Date: Wed, 16 Nov 2016 20:50:12 +0000 (-0500) Subject: https://github.com/ImageMagick/ImageMagick/issues/301 X-Git-Tag: 7.0.3-8~24 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ce98a7acbcfca7f0a178f4b1e7b957e419e0cc99;p=imagemagick https://github.com/ImageMagick/ImageMagick/issues/301 --- diff --git a/coders/sgi.c b/coders/sgi.c index 6b0e9eb5a..a0eebe97d 100644 --- a/coders/sgi.c +++ b/coders/sgi.c @@ -332,6 +332,8 @@ static Image *ReadSGIImage(const ImageInfo *image_info,ExceptionInfo *exception) if ((iris_info.bytes_per_pixel == 0) || (iris_info.bytes_per_pixel > 2)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); iris_info.dimension=ReadBlobMSBShort(image); + if ((iris_info.dimension == 0) || (iris_info.dimension > 3)) + ThrowReaderException(CorruptImageError,"ImproperImageHeader"); iris_info.columns=ReadBlobMSBShort(image); iris_info.rows=ReadBlobMSBShort(image); iris_info.depth=ReadBlobMSBShort(image);