Coverage Report

Created: 2026-06-10 06:25

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