diff --git a/coders/bmp.c b/coders/bmp.c index d3392a7cb..e84112256 100644 --- a/coders/bmp.c +++ b/coders/bmp.c @@ -669,6 +669,8 @@ static Image *ReadBMPImage(const ImageInfo *image_info,ExceptionInfo *exception) /* Microsoft Windows BMP image file. */ + if (bmp_info.size < 40) + ThrowReaderException(CorruptImageError,"ImproperImageHeader"); bmp_info.width=(ssize_t) ReadBlobLSBSignedLong(image); bmp_info.height=(ssize_t) ReadBlobLSBSignedLong(image); bmp_info.planes=ReadBlobLSBShort(image);