Artifact c77ca6455b35e1f37190a3796e08a3a49dfe66c04c32fc6b060d0ac4ab7c13b8:
- File
fuzz/fuzz_wiki.c
— part of check-in
[c7e932c08b]
at
2026-11-10 04:02:23
on branch schema-version
— Version the schema, and rebuild derived tables instead of migrating
State and derived tables are split into schema/state.sql and schema/index.sql, both applied on open. When the derived version changes, ctx rebuilds those tables from the repositories once; ctx rebuild does it on request. Technotes now record each turn's id, so a rebuilt index still knows which turns it holds. (user: dmestas, size: 926) [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, ctx_state_schema); db_exec(db, ctx_schema); 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; }