// Fuzz target for the Content-Disposition parser (AGENT-CORE §3: mojibake source, needs a // fuzz target). The parser must be total on any input — no crash, no UB, bounded work. // // clang++ -std=c++23 -fsanitize=fuzzer,address,undefined ... (see CMakeLists.txt) // ./fuzz_content_disposition -max_len=4096 corpus/content_disposition/ #include #include #include #include "vdm/net/content_disposition.hpp" extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) { std::string_view header(reinterpret_cast(data), size); auto cd = vdm::net::parse_content_disposition(header); // Light invariants: a returned filename never contains a path separator or NUL. for (char c : cd.filename) if (c == '/' || c == '\\' || c == '\0') __builtin_trap(); return 0; }