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/Progmasoft/fuzz_ProjectConfig.cpp | |
| 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/Progmasoft/fuzz_ProjectConfig.cpp')
| -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; +} |