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>
33 lines
1.2 KiB
C++
33 lines
1.2 KiB
C++
// Threat-intel list parsing (downloaded feed bodies) + IOC set loading.
|
|
#include "strawberry/ioc_set.hpp"
|
|
#include "strawberry/rule_updater.hpp"
|
|
|
|
#include <cstdint>
|
|
#include <cstdio>
|
|
#include <string>
|
|
#include <unistd.h>
|
|
#include <vector>
|
|
|
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
|
if (size == 0) return 0;
|
|
static const char* kinds[] = {"hashes", "domains", "ips", "nets"};
|
|
const std::string kind = kinds[data[0] % 4];
|
|
const std::string text(reinterpret_cast<const char*>(data) + 1, size - 1);
|
|
std::vector<std::string> out;
|
|
strawberry::parse_ioc_list(kind, text, 10000, out);
|
|
|
|
// The daemon loads normalized lists from disk: feed the raw text too.
|
|
static const std::string path = "/tmp/strawberry-fuzz-ioc-" + std::to_string(::getpid()) + ".txt";
|
|
if (FILE* f = std::fopen(path.c_str(), "wb")) {
|
|
std::fwrite(text.data(), 1, text.size(), f);
|
|
std::fclose(f);
|
|
strawberry::IocNetSet nets;
|
|
nets.load({{"ips", path}}, {{"nets", path}});
|
|
(void) nets.find("1.2.3.4");
|
|
(void) nets.find("2001:db8::1");
|
|
strawberry::IocHashSet hashes;
|
|
hashes.load({{"hashes", path}});
|
|
(void) hashes.find(std::string(64, 'a'));
|
|
}
|
|
return 0;
|
|
}
|