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 | # fuzzac3: cargo-fuzz targets for ec-ac3 |
| 2 | |
| 3 | Goal: DONE.md shared gate 2, at least one cargo-fuzz target per untrusted entry point in |
| 4 | ec-ac3 (AC-3 and E-AC-3 syncframe parsing and decode). |
| 5 | Base sha: 78ec1905 (main at worktree creation). |
| 6 | |
| 7 | ## What changed |
| 8 | - `crates/ec-ac3/fuzz/`: standalone cargo-fuzz crate (`ec-ac3-fuzz`, own `[workspace]`, path dep on ec-ac3). |
| 9 | - `decode_stream`: whole input treated as an elementary stream. Walks syncwords, uses |
| 10 | `ec_ac3::frame_size` to find each frame, and feeds each one to `Ac3Decoder::decode_frame` |
| 11 | (one decoder across the stream). Non-sync bytes are skipped one at a time. |
| 12 | - `parse_header`: `syncinfo::parse`, `bsi::parse` (from byte 5), `eac3::bsi::parse`, and |
| 13 | `frame_size` on the same input. |
| 14 | - `seed.sh`: AC-3 and E-AC-3 fixtures from `fixtures/audio`, truncated to 5 syncframes for |
| 15 | `decode_stream` and to the first 256 bytes for `parse_header` (12 + 12 seeds). |
| 16 | - `.gitignore` for `target`, `corpus`, `artifacts`, `coverage`. |
| 17 | - No CRC fixup in the targets. `ec-ac3` never checks CRCs on decode (`crc1` is "carried, not |
| 18 | checked"; the only CRC code is in the encoder), so mutated frames reach bit allocation and |
| 19 | mantissa decoding directly. |
| 20 | - Lint-only edits, no behaviour change, needed for the clippy gate: |
| 21 | - `src/decode.rs`: `self.exps = Box::new([[0; COEFFS]; CHANNELS])` became |
| 22 | `*self.exps = [[0; COEFFS]; CHANNELS]` (no allocation). |
| 23 | - `src/encode.rs`, `tests/encode_matrix.rs`, `tests/decode_matrix.rs`: `chunks_exact(N)` with |
| 24 | a constant N became `as_chunks::<N>().0`. |
| 25 | - `src/stack_budget.rs`: `eprintln!("{}", "TYPE")` literal inlined into the format string. |
| 26 | |
| 27 | ## Verify commands and results |
| 28 | All run through `scripts/remote-run.sh fuzzac3`, from the worktree. |
| 29 | - `cargo +nightly fuzz run decode_stream --fuzz-dir crates/ec-ac3/fuzz -- -max_total_time=120 -rss_limit_mb=3000 -timeout=10` |
| 30 | (host b): exit 0, 29713 runs in 121 s, no crash, timeout or OOM. |
| 31 | - `... parse_header ...` (host b): exit 0, 9274055 runs in 121 s, no crash, timeout or OOM. |
| 32 | First background attempts were lost to a host-b rsync failure (another lane's directory) and |
| 33 | a slot-busy window on host a; both re-run in the foreground. |
| 34 | - `cargo clippy -p ec-ac3 --all-targets -- -D warnings` (host): exit 0 after the lint fixes above. |
| 35 | - `cargo test -p ec-ac3 --release --no-fail-fast`: exit 0. Results: 43 passed (lib), 8 passed, |
| 36 | 6 passed, 0 failed. |
| 37 | |
| 38 | ## Crashes |
| 39 | None found in the two smoke runs. No reproducers, so no fixes were needed and no regression test was added. |
| 40 | |
| 41 | ## Left open |
| 42 | - The gate asks for 1 CPU-hour per target. Only 120 s smoke runs were done, so the gate is not met. |
| 43 | - Corpus is seeded from fixtures only; no minimised corpus or coverage measured. |
| 44 | - `fuzz/Cargo.lock` was generated on the host and is not in this commit. |
| 45 | - Options (`Downmix`, `dither`, `drc_scale`) are left at defaults in both targets; the |
| 46 | downmix paths are not reached by the fuzzer. |