Summary
Add property-based and fuzz tests for the Python, Rust, and C codec surfaces, with particular focus on malformed frames and stream resynchronization.
Motivation
The existing golden vectors verify known examples, but malformed inputs and arbitrary byte streams have a much larger state space. Property-based and fuzz testing can uncover length-field errors, integer boundary problems, parser hangs, inconsistent rejection behavior, and cases where corruption causes unnecessary loss of later valid frames.
Proposed properties
- Decoding arbitrary bytes never crashes, hangs, or performs unbounded allocation.
- Valid packets survive
decode(encode(packet)) round trips.
- Frames with invalid CRCs are never accepted.
- Python, C, and Rust agree on valid and invalid corpus entries.
- A stream receiver eventually recovers after arbitrary garbage followed by a valid frame.
- Corrupt input cannot prevent later complete valid frames from being recovered indefinitely.
- Boundary values for packet size, counts, timestamps, and sequence wraparound behave consistently.
Proposed scope
- Use Hypothesis for the Python codec and stream receiver.
- Use
proptest or cargo-fuzz for Rust.
- Add a C fuzz target compatible with libFuzzer or AFL++.
- Maintain a small shared regression corpus for interesting failures.
- Run bounded property tests in normal CI and deeper fuzzing in a scheduled workflow.
Acceptance criteria
Summary
Add property-based and fuzz tests for the Python, Rust, and C codec surfaces, with particular focus on malformed frames and stream resynchronization.
Motivation
The existing golden vectors verify known examples, but malformed inputs and arbitrary byte streams have a much larger state space. Property-based and fuzz testing can uncover length-field errors, integer boundary problems, parser hangs, inconsistent rejection behavior, and cases where corruption causes unnecessary loss of later valid frames.
Proposed properties
decode(encode(packet))round trips.Proposed scope
proptestorcargo-fuzzfor Rust.Acceptance criteria