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