Rename fuzz target

This commit is contained in:
Kevin Backhouse
2021-07-12 10:53:04 +01:00
parent bf786f4cc6
commit a3e4efe6b4
2 changed files with 1 additions and 1 deletions
+29
View File
@@ -0,0 +1,29 @@
#include <exiv2/exiv2.hpp>
#include <iostream>
#include <iomanip>
#include <cassert>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t * Data, size_t Size) {
// Invalid files generate a lot of warnings, so switch off logging.
Exiv2::LogMsg::setLevel(Exiv2::LogMsg::mute);
Exiv2::XmpParser::initialize();
::atexit(Exiv2::XmpParser::terminate);
try {
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(Data, Size);
assert(image.get() != 0);
image->readMetadata();
Exiv2::ExifData &exifData = image->exifData();
if (exifData.empty()) {
return -1;
}
} catch(...) {
// Exiv2 throws an exception if the metadata is invalid.
}
return 0;
}