Background
Part of the qjson fuzz harness (#63). The v1/v2 targets drive the safe Rust
API (Document::parse_with_options + cursor methods) and therefore never
touch the unsafe pointer juggling at the FFI layer.
CLAUDE.md names the critical invariants that only the C ABI can violate:
scratch-pointer invalidation across *_get_str calls, the 'a → 'static
lifetime transmute in qjson_parse, cursor-after-free, and double-free.
Depends on #63. Stretch goal — open after v1/v2 land.
Goal
A stateful, op-sequence fuzz target over the C ABI: generate a sequence
qjson_parse → {qjson_get_* / qjson_cursor_* / qjson_cursor_object_entry_at}* → qjson_free from arbitrary input and run it under ASAN to surface UAF /
double-free / OOB in the cursor + skip-cache + scratch machinery.
Scope (this issue = one PR)
Acceptance Criteria
Notes
Affected files
fuzz/fuzz_targets/fuzz_ffi_ops.rs (new)
fuzz/Cargo.toml (arbitrary dep)
Part of #63. Depends on #63. Relates to #66.
Background
Part of the qjson fuzz harness (#63). The v1/v2 targets drive the safe Rust
API (
Document::parse_with_options+ cursor methods) and therefore nevertouch the
unsafepointer juggling at the FFI layer.CLAUDE.md names the critical invariants that only the C ABI can violate:
scratch-pointer invalidation across
*_get_strcalls, the'a → 'staticlifetime transmute in
qjson_parse, cursor-after-free, and double-free.Depends on #63. Stretch goal — open after v1/v2 land.
Goal
A stateful, op-sequence fuzz target over the C ABI: generate a sequence
qjson_parse → {qjson_get_* / qjson_cursor_* / qjson_cursor_object_entry_at}* → qjson_freefromarbitraryinput and run it under ASAN to surface UAF /double-free / OOB in the cursor + skip-cache + scratch machinery.
Scope (this issue = one PR)
arbitrarydev-dependency; model an op enum(Parse / GetStr / GetI64 / GetF64 / GetBool / CursorField / CursorIndex /
ObjectEntryAt / Free).
&[u8]into an op sequence and drive the C ABI under ASAN.get_strpointer-invalidation contract (consume the(ptr,len)immediately, before the next*_get_str) so the harness doesnot flag a by-design footgun as a bug.
Acceptance Criteria
get_strlifetime contract is respected (no false positives fromholding a stale pointer across calls).
Notes
skip-cache OOB and free-timing (UAF / double-free); core decode logic
overlaps with v2 (test(fuzz): v2 lazy value-equality differential + Phase 2 walker #72).
Affected files
fuzz/fuzz_targets/fuzz_ffi_ops.rs(new)fuzz/Cargo.toml(arbitrarydep)Part of #63. Depends on #63. Relates to #66.