Coverage Report

Created: 2026-07-16 06:50

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/exiv2/fuzz/fuzz-read-write.cpp
Line
Count
Source
1
#include <exiv2/exiv2.hpp>
2
3
#include <cassert>
4
#include <iomanip>
5
#include <iostream>
6
7
20.7k
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
8
  // Invalid files generate a lot of warnings, so switch off logging.
9
20.7k
  Exiv2::LogMsg::setLevel(Exiv2::LogMsg::mute);
10
11
20.7k
  try {
12
20.7k
    Exiv2::DataBuf data_copy(data, size);
13
20.7k
    Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(data_copy.c_data(), size);
14
20.7k
    assert(image.get() != 0);
15
16
20.7k
    image->readMetadata();
17
20.7k
    image->writeMetadata();
18
19
20.7k
  } catch (...) {
20
    // Exiv2 throws an exception if the metadata is invalid.
21
11.4k
  }
22
23
20.7k
  return 0;
24
20.7k
}