From 8383c44b8f408de256e248a96c3c8192f5bece1f Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Tue, 16 Jan 2018 22:48:17 +0100 Subject: [PATCH] Added extra check to avoid use of uninitialized value. Credit to OSS-Fuzz --- coders/viff.c | 2 ++ 1 file changed, 2 insertions(+) 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); -- 2.40.0