edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching·0 forks·Rust·370.3 MiB·9b67700·Tahinli·3 days ago·4021 commits
| 1 | # Lane fuzzmkv: cargo-fuzz targets for the ec-matroska demuxer |
| 2 | |
| 3 | ## Goal |
| 4 | cargo-fuzz targets for the ec-matroska demuxer. Every crash found gets a fix and a regression replay test. |
| 5 | |
| 6 | ## Base |
| 7 | - Lane branch `lane/fuzzmkv`, merged `main` at `322837a2` (`git merge main` after the WIP commit). |
| 8 | - `main` had moved on to `5833f6d9` by the time of this report; this lane was not re-merged against it. |
| 9 | |
| 10 | ## What changed |
| 11 | - `crates/ec-matroska/fuzz/`: cargo-fuzz crate with seven targets (`demux_packets`, `ebml_walk`, `index`, `lacing`, `open_tracks`, `seek`, `tracks`), a seed script, and `.gitignore` for corpus and artifacts. |
| 12 | - `crates/ec-matroska/src/fuzz_api.rs` (`#[doc(hidden)]`): thin entry points for the targets. |
| 13 | - `crates/ec-matroska/src/demux.rs`: overflow-safe arithmetic for element offsets, cue and seek positions, block timestamps, lace sizes, and SAR; a `MAX_CHANNELS` (255) refusal for audio tracks; an `UNPACKED_LIMIT` (256 MiB) per cluster for inflated or header-stripped frames; `parse_tracks` now returns `Result`. Internal helpers are `pub(crate)` for the tests. |
| 14 | - `crates/ec-core/src/timebase.rs`: `checked_rescale` uses checked i128 multiplication. |
| 15 | - `crates/ec-matroska/tests/fuzz_regressions.rs`: replay tests for the crashes found so far. |
| 16 | - `crates/ec-matroska/tests/matroska.rs`: clippy-driven changes in the test helpers (`AudioTrack` type alias, `as_chunks`). |
| 17 | |
| 18 | ## Fuzz runs (1 CPU-hour per target) |
| 19 | Each target ran for `-max_total_time=3600` with its own process and core, four concurrently on host c and three on host b. The first attempt on both hosts never started (a script path bug); the runs below are the ones that count. |
| 20 | |
| 21 | | Target | Host | Wall | Runs | Avg exec/s (last progress line) | Exit | Crash artifacts | |
| 22 | |---|---|---|---|---|---|---| |
| 23 | | demux_packets | c | 3601 s | 8,518,009 | 2365 | 0 | none | |
| 24 | | seek | c | 3601 s | 12,526,732 | 3478 | 0 | none | |
| 25 | | ebml_walk | c | 3602 s | 60,757,433 | 16872 | 0 | none | |
| 26 | | lacing | c | 3601 s | 277,069,449 | 76942 | 0 | none | |
| 27 | | open_tracks | b | 3602 s | 16,373,362 | 4546 | 0 | none | |
| 28 | | index | b | 3602 s | 114,021,080 | 31663 | 0 | none | |
| 29 | | tracks | b | 3602 s | 111,984,373 | 31098 | 0 | none | |
| 30 | |
| 31 | No crashes, timeouts, or OOMs were found in these runs. No new fixes or replay tests were needed in this pass; the replay tests already in the branch cover the crashes found in the earlier session. |
| 32 | |
| 33 | ## Verify |
| 34 | Run on host c via `scripts/remote-run.sh fuzzmkv --host auto`: |
| 35 | |
| 36 | - `cargo test --release -p ec-matroska -p ec-core`: exit 0. Results per test binary: 44 passed, 10 passed, 10 passed, 8 passed with 5 ignored (the ignores are pre-existing), and two empty binaries (doc tests). 0 failures. |
| 37 | - `cargo clippy -p ec-matroska -p ec-core --all-targets -- -D warnings`: exit 0, clean. |
| 38 | |
| 39 | ## Left |
| 40 | - Fuzz runs are 1 h each, so coverage is still short of a long soak. Re-run the targets on the next lane pass. |
| 41 | - Re-merge with `main` (now `5833f6d9`) before the lane merges. |
| 42 | - The first attempt at both fuzz waves failed silently (an unset path in the wave script) and was re-run; the hosts were clean before the final run. |