Coverage Report

Created: 2025-07-12 06:43

/src/glaze/fuzzing/json_prettify.cpp
Line
Count
Source
1
#include <cstddef>
2
#include <cstdint>
3
#include <glaze/glaze.hpp>
4
#include <vector>
5
6
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size)
7
15.6k
{
8
   // use a vector with null termination instead of a std::string to avoid
9
   // small string optimization to hide bounds problems
10
15.6k
   std::vector<char> buffer{Data, Data + Size};
11
12
   // non-null terminated
13
15.6k
   {
14
15.6k
      const auto& input = buffer;
15
15.6k
      [[maybe_unused]] auto beautiful = glz::prettify_json(input);
16
15.6k
   }
17
18
   // null terminated
19
15.6k
   {
20
15.6k
      buffer.push_back('\0');
21
15.6k
      const auto& input = buffer;
22
15.6k
      [[maybe_unused]] auto beautiful = glz::prettify_json(input);
23
15.6k
   }
24
25
15.6k
   return 0;
26
15.6k
}