strawberry/fuzz/fuzz_config.cpp
trvon 6628ea9aea
Harden against crashes and I/O faults
Fix for the 2026-10-25 host freeze (an uncaught iostream exception on a
/proc read aborted the daemon; its core dump deadlocked with the exec
guard): non-throwing /proc reads, crash handlers that release fanotify
permission fds, guarded thread entries, from_chars parsing.

Adds the io fault-injection seam with property tests, source invariant
checks (R1-R6) with self-test fixtures, libFuzzer targets and seeds
(including I/O-fault fuzzing), the fold changed-files scan scripts and
the agent workflow docs (CLAUDE.md, prompts).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 18:17:17 -06:00

18 lines
569 B
C++

// strawberry.conf parsing (root-owned, but must never crash the daemon).
#include "strawberry/config.hpp"
#include <cstdint>
#include <cstdio>
#include <string>
#include <unistd.h>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
static const std::string path = "/tmp/strawberry-fuzz-conf-" + std::to_string(::getpid());
if (FILE* f = std::fopen(path.c_str(), "wb")) {
std::fwrite(data, 1, size, f);
std::fclose(f);
strawberry::Config config;
(void) config.load_from_file(path);
}
return 0;
}