mirror of
https://github.com/troglobit/finit.git
synced 2026-09-30 13:02:37 +07:00
__msg_parse() turns bytes off a socket into pointers, before anything has vouched for the peer, and it is the only place in libink that does. It had no test of its own beyond whatever the other tests happened to send it, all of it well-formed. The target checks the parser's contract, not merely that it survived. A header field must point into the header field array, and terminate inside it, and the parse must never claim more bytes than it was handed. Crash-only would pass a parser that walked into the body and returned fields from there, since those bytes were handed over too. The expected bounds are derived from the raw header rather than from the parser, so the two have to agree independently. Every input is copied into an allocation sized to it first. Reading past the end of a roomy buffer stays inside the allocation and the sanitizer never sees it; against an exact one the same read is a fault, which is where the sharpest findings come from. Under libFuzzer it is an ordinary fuzz target and named files replay, which is how a find gets reproduced. With no arguments it runs a fixed sweep -- every truncation, every single-byte corruption, every value of the length that decides where the header ends, and seeded garbage -- so the suite covers the same contract on every build, without clang or a corpus in the tree. It takes 40 ms. CI fuzzes it properly on every pull request, keeps the crashers, and carries the corpus between runs so it reaches deeper over time than any single run can. Note that clang links the fuzzer runtime against the newest GCC tree it finds, so the libstdc++ headers have to match that one and not the default compiler, which is worth saying since installing the obvious package leaves you exactly where you started. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
60 lines
698 B
Plaintext
60 lines
698 B
Plaintext
*~
|
|
*.o
|
|
*.so
|
|
*.gz
|
|
ID
|
|
GPATH
|
|
GRTAGS
|
|
GSYMS
|
|
GTAGS
|
|
|
|
# GNU configure and build system
|
|
/aux
|
|
/.deps
|
|
/autom4te.cache
|
|
/aclocal.m4
|
|
/ar-lib
|
|
/backup/
|
|
/compile
|
|
/config.cache
|
|
/config.h
|
|
/config.mk
|
|
/config.guess
|
|
/config.h.in
|
|
/config.log
|
|
/config.status
|
|
/config.sub
|
|
/configure
|
|
/depcomp
|
|
/install-sh
|
|
/libtool
|
|
/ltmain.sh
|
|
/missing
|
|
/Makefile
|
|
/Makefile.in
|
|
/stamp-h1
|
|
|
|
/test-driver
|
|
/test-suite.log
|
|
|
|
# Misc
|
|
/.gdb_history
|
|
|
|
# TroglOS build system
|
|
/.config
|
|
/.stamp
|
|
/.unpacked
|
|
|
|
# WeOS build system
|
|
/.autoconf
|
|
/.automake
|
|
/.built
|
|
|
|
# VS Code user settings
|
|
.vscode
|
|
|
|
# Fuzzing: the target is built by hand with clang, see doc/build.md,
|
|
# and the corpus it grows is a local artefact, not something to ship
|
|
/fuzz-msg-parse
|
|
/.fuzz-corpus/
|