MCPcopy Create free account
hub / github.com/Exiv2/exiv2 / LLVMFuzzerTestOneInput

Function LLVMFuzzerTestOneInput

fuzz/fuzz-read-write.cpp:7–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include <iostream>
6
7extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
8 // Invalid files generate a lot of warnings, so switch off logging.
9 Exiv2::LogMsg::setLevel(Exiv2::LogMsg::mute);
10
11 Exiv2::XmpParser::initialize();
12 ::atexit(Exiv2::XmpParser::terminate);
13
14 try {
15 Exiv2::DataBuf data_copy(data, size);
16 Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(data_copy.c_data(), size);
17 assert(image.get() != 0);
18
19 image->readMetadata();
20 image->writeMetadata();
21
22 } catch (...) {
23 // Exiv2 throws an exception if the metadata is invalid.
24 }
25
26 return 0;
27}

Callers

nothing calls this directly

Calls 4

c_dataMethod · 0.80
getMethod · 0.80
readMetadataMethod · 0.45
writeMetadataMethod · 0.45

Tested by

no test coverage detected