test(fuzz): add a Clang/libFuzzer target for the header-only parsers
This commit is contained in:
1 parent
fd9e8673c0
commit
c2b80416a5
9 files changed
+64
-1
No files matched your search
@@ -0,0 +1,19 @@
|
||||
// Coverage-guided fuzz target for the standalone parsers (Clang/libFuzzer).
|
||||
// Build and run through fuzz/run.sh.
|
||||
#include <Void/Data/StrictJson.hpp>
|
||||
#include <Void/Text/Semver.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <string_view>
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) {
|
||||
const std::string_view input{reinterpret_cast<const char *>(data), size};
|
||||
(void)Void::Json::Strict::parse(input);
|
||||
// TOML/lockfile/tar are covered by the deterministic mutation harness
|
||||
// (CoreEngineTests.fuzz_mutated_inputs_never_crash_parsers): their implementations
|
||||
// are not header-only.
|
||||
(void)Void::Semver::parse_range(input);
|
||||
(void)Void::Semver::parse_strict(input);
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user