Artifact 1aa6b76d4cf54341c6a4de4d008e1799a3cb1eed9a29dd6cd0dbbf35de6ea3c2:
- File
fuzz/fuzz_notes.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: 657) [annotate] [blame] [check-ins using] [more...]
/* Technotes from another machine: every byte of text ends up in exactly one turn * or in a heading, never read past the end. */ #define CTX_NO_MAIN #include "../src/ctx.c" static void count(void *ctx, const char *role, const char *at, const char *uuid, const char *body, size_t n) { size_t *total = ctx; if (!role || !at || !uuid || (n && !body)) __builtin_trap(); *total += n; } int LLVMFuzzerTestOneInput(const unsigned char *data, size_t n) { char *t = malloc(n + 1); if (!t) return 0; memcpy(t, data, n); t[n] = 0; size_t total = 0; note_turns(t, count, &total); if (total > strlen(t)) __builtin_trap(); free(t); return 0; }