From: Dirk Lemstra Date: Tue, 16 Jan 2018 21:48:17 +0000 (+0100) Subject: Added extra check to avoid use of uninitialized value. X-Git-Tag: 7.0.7-22~48 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8383c44b8f408de256e248a96c3c8192f5bece1f;p=imagemagick Added extra check to avoid use of uninitialized value. Credit to OSS-Fuzz --- diff --git a/coders/viff.c b/coders/viff.c index b79f2115a..d88a885d4 100644 --- a/coders/viff.c +++ b/coders/viff.c @@ -292,6 +292,8 @@ static Image *ReadVIFFImage(const ImageInfo *image_info, &viff_info.machine_dependency); (void) ReadBlob(image,sizeof(viff_info.reserve),viff_info.reserve); count=ReadBlob(image,512,(unsigned char *) viff_info.comment); + if (count != 512) + ThrowReaderException(CorruptImageError,"ImproperImageHeader"); viff_info.comment[511]='\0'; if (strlen(viff_info.comment) > 4) (void) SetImageProperty(image,"comment",viff_info.comment,exception);