Coverage Report

Created: 2025-07-09 06:27

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