Artifact 6a8886b0ccc1933502af8b258f0918a80e694c0d165040b297388613e700f6bb:
- File
fuzz/fuzz_redact.c
— part of check-in
[e827ba9421]
at
2026-11-10 03:43:25
on branch fuzz
— Fuzz the parsers and run the suite under sanitizers
make sanitize runs every test under AddressSanitizer and UBSan, and make fuzz runs libFuzzer on redaction, transcript lines, wiki pages and technotes, checking properties as well as crashes. They found real bugs, fixed here: a token glued to another survived redaction, redaction was not idempotent around Doppler output and URL credentials, and a Doppler rule matched its own marker. Two findings are in libfossil and are reported there; only those checks are off, only for those objects. (user: dmestas, size: 1028) [annotate] [blame] [check-ins using] [more...]
/* Redaction: no input crashes it, redacting twice changes nothing, and no secret a * rule recognizes survives. */ #define CTX_NO_MAIN #include "../src/ctx.c" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t n) { buf once = {0}, twice = {0}; add_redacted(&once, (const char *)data, n); add_redacted(&twice, once.p ? once.p : "", once.n); if (once.n != twice.n || (once.n && memcmp(once.p, twice.p, once.n))) __builtin_trap(); for (size_t i = 0; i < once.n; i++) { size_t from; const char *name = NULL; size_t e = secret_at(once.p, once.n, i, &from, &name, 0); if (e && !(e - from == strlen(REDACTED) && !memcmp(once.p + from, REDACTED, e - from))) __builtin_trap(); } for (size_t i = 0; i < n;) { /* the audit's candidate scan must stay in bounds */ size_t from; const char *name; size_t e = candidate_at((const char *)data, n, i, &from, &name); if (e && (e > n || from > e)) __builtin_trap(); i = e ? e : i + 1; } free(once.p); free(twice.p); return 0; }