Coverage Report

Created: 2026-01-10 07:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/dng_sdk/fuzzer/dng_parser_fuzzer.cpp
Line
Count
Source
1
#include <stddef.h>
2
#include <stdint.h>
3
4
#include "dng_exceptions.h"
5
#include "dng_host.h"
6
#include "dng_info.h"
7
#include "dng_memory_stream.h"
8
#include "dng_negative.h"
9
10
11
1.38k
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
12
1.38k
  dng_host host;
13
1.38k
  dng_memory_stream stream(host.Allocator());
14
15
1.38k
  stream.Put(data, size);
16
1.38k
  stream.SetReadPosition(0);
17
18
1.38k
  std::unique_ptr<dng_negative> negative(host.Make_dng_negative());
19
20
1.38k
  try {
21
1.38k
    dng_info info;
22
1.38k
    info.Parse(host, stream);
23
1.38k
    info.PostParse(host);
24
25
1.38k
    if (info.IsValidDNG()) {
26
1.14k
      negative->Parse(host, stream, info);
27
1.14k
      negative->PostParse(host, stream, info);
28
1.14k
      negative->ReadStage1Image(host, stream, info);
29
1.14k
    }
30
1.38k
  } catch (dng_exception &e) {
31
    // dng_sdk throws C++ exceptions on errors
32
    // catch them here to prevent libFuzzer from crashing.
33
1.25k
  }
34
35
1.38k
  return 0;
36
1.38k
}