Artifact 47f264dfb8b7ff044bc575e2b9b5030f419d9d6210ceab245a4ad25ca9758be3:
- File
fuzz/fuzz_wiki.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: 963) [annotate] [blame] [check-ins using] [more...]
/* Wiki pages: citation and link parsing, the claim checks, sentence extraction and * link encoding, on any text. */ #define CTX_NO_MAIN #include "../src/ctx.c" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t n) { static sqlite3 *db; if (!db) { sqlite3_auto_extension((void (*)(void))fsl_sqlext_init); /* as main does */ db = db_open(":memory:"); db_exec(db, "CREATE TABLE ctx_doc(id INTEGER PRIMARY KEY, project, kind, name, status, hash);"); index_prepare(db); } char *t = malloc(n + 1); if (!t) return 0; memcpy(t, data, n); t[n] = 0; wiki_parse(db, t); body_check(db, t); char claim[4096]; claim_of(t, "a", claim, sizeof claim); char *u = url_param(t, "name"); free(u); free(squeeze(t, strlen(t))); size_t g = generated_at(t); if (g > strlen(t)) __builtin_trap(); encode_page_links(t); char *r = footnote_repin(t, "a", "sources/x.md", "0123456789abcdef"); free(r); free(t); return 0; }