Coverage Report

Created: 2025-08-29 06:18

/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
16.0k
{
8
   // use a vector with null termination instead of a std::string to avoid
9
   // small string optimization to hide bounds problems
10
16.0k
   std::vector<char> buffer{Data, Data + Size};
11
12
   // non-null terminated
13
16.0k
   {
14
16.0k
      const auto& input = buffer;
15
16.0k
      [[maybe_unused]] auto beautiful = glz::prettify_json(input);
16
16.0k
   }
17
18
   // null terminated
19
16.0k
   {
20
16.0k
      buffer.push_back('\0');
21
16.0k
      const auto& input = buffer;
22
16.0k
      [[maybe_unused]] auto beautiful = glz::prettify_json(input);
23
16.0k
   }
24
25
16.0k
   return 0;
26
16.0k
}