diff options
| author | Leitwolf | 2026-10-30 00:07:08 +0300 |
|---|---|---|
| committer | GitHub | 2026-10-30 00:07:08 +0300 |
| commit | 5d713685c54bb491ad1bbb0fd8f80318bfaf7103 (patch) | |
| tree | fed3945312bd75d050c9c3163584b1ae6fcb1b93 /fuzzing | |
| parent | db9f14bb7f38425e6005ae2212d83f01f9f2f8be (diff) | |
| parent | 471756b77331fa1ab77bc94e6aae228baef903e0 (diff) | |
| download | catch3-ci/narrow-macos.tar.gz | |
Merge branch 'devel' into ci/narrow-macosci/narrow-macos
Diffstat (limited to 'fuzzing')
| -rw-r--r-- | fuzzing/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | fuzzing/Progmasoft/fuzz_ProjectConfig.cpp | 30 |
2 files changed, 31 insertions, 1 deletions
diff --git a/fuzzing/CMakeLists.txt b/fuzzing/CMakeLists.txt index 05591520..c5b71e9c 100644 --- a/fuzzing/CMakeLists.txt +++ b/fuzzing/CMakeLists.txt @@ -20,7 +20,7 @@ foreach(fuzzer TestSpecParser) endforeach() # Progmasoft's fuzzers live apart, under their own license header. -foreach(fuzzer RunnerJson RunnerOptions) +foreach(fuzzer ProjectConfig RunnerJson RunnerOptions) add_executable(fuzz_${fuzzer} Progmasoft/fuzz_${fuzzer}.cpp) target_link_libraries(fuzz_${fuzzer} PRIVATE fuzzhelper) endforeach() 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; +} |