]> granicus.if.org Git - imagemagick/commitdiff
Added extra check to avoid use of uninitialized value.
authorDirk Lemstra <dirk@git.imagemagick.org>
Tue, 16 Jan 2018 21:48:17 +0000 (22:48 +0100)
committerDirk Lemstra <dirk@git.imagemagick.org>
Tue, 16 Jan 2018 21:48:17 +0000 (22:48 +0100)
Credit to OSS-Fuzz

coders/viff.c

index b79f2115ad7e3bc50a0abd7b46e7254badeab93d..d88a885d496585ad214f1fbba934dbf35b7c97a5 100644 (file)
@@ -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);