Add build plumbing for libFuzzer+ASan fuzz build, addresses #283

- CMakeLists MCRF_FUZZER option (clang-only, -fsanitize=fuzzer-no-link)
- Makefile fuzz-build/fuzz/fuzz-long/fuzz-repro/clean-fuzz targets
- CommandLineParser -- passthrough after --exec for forwarding libFuzzer argv
- McRFPy_API: forward script_args to sys.argv in --exec mode so atheris.Setup()
  sees libFuzzer flags; set sys.argv[0] to the exec script path to match Python
  script-mode conventions
- .gitignore build-fuzz/ and corpora/crashes dirs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
John McCardle 2026-04-10 10:35:44 -04:00
commit 136d2a2a25
5 changed files with 93 additions and 1 deletions

View file

@ -121,6 +121,19 @@ CommandLineParser::ParseResult CommandLineParser::parse(McRogueFaceConfig& confi
config.exec_scripts.push_back(argv[current_arg]);
config.python_mode = true;
current_arg++;
// Look for `--` passthrough marker: everything after it becomes script_args
// (forwarded to sys.argv so fuzzers/libFuzzer can receive their flags).
int scan = current_arg;
while (scan < argc) {
if (std::string(argv[scan]) == "--") {
for (int i = scan + 1; i < argc; i++) {
config.script_args.push_back(argv[i]);
}
current_arg = argc;
break;
}
scan++;
}
continue;
}