diff options
| author | Leitwolf | 2026-10-30 00:06:27 +0300 |
|---|---|---|
| committer | GitHub | 2026-10-30 00:06:27 +0300 |
| commit | 471756b77331fa1ab77bc94e6aae228baef903e0 (patch) | |
| tree | 3af5223ff664544d15eaf20a10eccdf3465d9958 /fuzzing/Progmasoft | |
| parent | 1d48419b7ef642917ebf7dfd16c3bc1b3050d8f1 (diff) | |
| parent | 0b4b57a0688f2943f4c797c20d68d533cf70fd15 (diff) | |
| download | catch3-471756b77331fa1ab77bc94e6aae228baef903e0.tar.gz | |
Merge pull request #20 from Progmasoft/feature/catch3-json
Read the options of a project from catch3.json
Diffstat (limited to 'fuzzing/Progmasoft')
| -rw-r--r-- | fuzzing/Progmasoft/fuzz_ProjectConfig.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/fuzzing/Progmasoft/fuzz_ProjectConfig.cpp b/fuzzing/Progmasoft/fuzz_ProjectConfig.cpp new file mode 100644 index 00000000..0c43f550 --- /dev/null +++ b/fuzzing/Progmasoft/fuzz_ProjectConfig.cpp @@ -0,0 +1,30 @@ +// Copyright (c) 2026 Progmasoft. +// SPDX-License-Identifier: MPL-2.0 WITH AdditionRef-Progmasoft-Exception-1.1 + +// The text of a catch3.json. Reading it must give options or an error, never +// crash, and the worker arguments derived from the options must parse again. + +#include <Progmasoft/Runner/Options.hpp> +#include <Progmasoft/Runner/ProjectConfig.hpp> + +#include <cstdint> +#include <cstdlib> +#include <string_view> + +extern "C" int +LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) +{ + namespace Runner = Progmasoft::Catch3::Runner; + const std::string_view text{reinterpret_cast<const char *>(data), size}; + auto options = Runner::ApplyProjectConfig(text, "project", "catch3.json"); + if (options) + { + const auto worker = + Runner::ParseOptions(Runner::WorkerArguments(*options)); + if (!worker) + { + std::abort(); + } + } + return 0; +} |