forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on a5441e893b7600aec0ba2cc81a55cad4b8837f2bFiltered to crates/ec-riff/src/read.rsClear filter

2026-08-21

2026-08-14

fix(riff): refuse the headers hound refuses, and say so honestlyAhmet Kaan Gümüş · 30d372e
fix(riff): refuse the headers hound refuses, and say so honestly

The WAV reader accepted three files hound rejects, each one a silent misread
rather than an error: a `data` chunk shorter than its declared size read as a
complete file, a padded container (8-bit samples in 2-byte slots) read at the
wrong stride so every frame after the first came from the wrong offset, and a
depth that is not a whole number of bytes (12-, 20-bit) taken as if it were.

The stride and depth checks live in `ec-riff`'s `parse_fmt`, where every reader
routes through; the odd depth is `corrupt` and the padded container
`unsupported`, which the shim maps to hound's `FormatError` and `Unsupported`
respectively. Truncation is checked in the shim instead: `ec-riff` deliberately
reads what is there and reports it, so the shim compares the sample count
against the frame count the `data` header promised and yields hound's
`UnexpectedEof`. The write path is untouched.

The shim's header claimed its differences were "all in the strict direction",
which was true of writing and false of reading; it now lists the reader
divergences that remain -- single-item error iterators where hound repeats the
refusal per sample, and its own wording.

Checks: `cargo test -p hound` (5 tests) covers a truncated file, a padded
container, 12- and 20-bit depths and a well-formed control; `cargo test -p
ec-riff` is unchanged, its truncation-tolerance test included.
feat(riff): WAV reader/writer and the hound shim over itAhmet Kaan Gümüş · 5dd56cf
feat(riff): WAV reader/writer and the hound shim over it

ec-riff writes and reads RIFF/WAVE: 8/16/24/32-bit integer PCM and 32-bit
float, mono through 7.1, any sample rate. The writer streams and patches the
RIFF, data and fact sizes in finalize (best-effort on drop), and emits
WAVE_FORMAT_EXTENSIBLE with a channel mask whenever a file has more than two
channels or more than 16 bits. The reader walks the chunk list rather than
assuming fmt-then-data, so LIST/INFO, fact and odd-sized chunks with their pad
byte are skipped, and a truncated or unpatched data size yields what is
actually there. RF64, ADPCM and 64-bit float are refused by name.

shims/hound carries package name hound 3.5.1 over ec-riff, covering exactly
what edith consumes: WavWriter::create/write_sample/finalize, WavSpec,
SampleFormat and an Error with the incumbent's variants.

Checks: cargo test -p ec-riff -p hound (10 tests), and the emitted oracle
artifacts compared against ffmpeg's own decode - 5 written formats and the 6
wav fixtures all PASS at corr 1.000000, RMS delta 0.