Skip to content

foxenflac, microflac and claxon exit 1 on an input that ends before its stream does - #91

Merged
closer-claudio merged 1 commit into
mainfrom
claudio/20261121-decoder-ends
Nov 22, 2026
Merged

closer-claudio merged 1 commit into
mainfrom
claudio/20261121-decoder-ends

Conversation

@closer-claudio

Copy link
Copy Markdown
Contributor

🎯 Why

Three of the FLAC decoder programs exited 0 on an input that ended early, where flac -d exits 1 and each README promises "1 on any error":

  • foxenflac and microflac wrote an empty output and exited 0 when the input ended before the stream info: a file that is not FLAC, a file of a few bytes, a cut inside STREAMINFO.
  • claxon wrote a short output and exited 0 on a stream cut at a frame boundary.

The libraries under them are fed bytes, or iterate to the end of them, and report nothing wrong there: the program is the only place that knows the input ended.

🛠️ What

  • foxenflac/main.c, microflac/main.cpp: exit 1 when the input ended and the stream info never came.
  • claxon/src/main.rs: the output is held to the frame count STREAMINFO declares, as drflac, foxenflac, microflac and cscoreflac already did.
  • symphonia is unchanged: Symphonia reports "unexpected end of file" there itself.
  • scripts/decoder-smoke.sh: two rows for all six programs, neither of which may exit 0: the 16-bit stream cut to its first three bytes, and cut at a frame boundary. The second is the whole stream cut to the length of a stream of its first blocks; encoded without a seek table, the two differ in their stream info alone.
  • The READMEs say so.

🧪 How

On darwin-arm64, binaries built from main against binaries built from this head:

  • foxenflac: before, the three-byte row fails (exit 0); after, every row passes.
  • claxon: before, the frame-boundary row fails (exit 0); after, every row passes.
  • symphonia: every row passes before and after.

microflac, drflac and cscoreflac were not run locally; the checks on this pull request run all six on every platform.

📝 Notes

A consumer sees exit 1 where it saw exit 0 only on an input that is cut short or is not FLAC.

foxenflac and microflac exited 0 with an empty output on an input that
ended before the stream info (a file that is not FLAC, a few bytes, a
cut inside STREAMINFO), and claxon exited 0 with a short output on a
stream cut at a frame boundary. `flac -d` exits 1 in each case, and
each README promises 1 on any error. These libraries are fed bytes, or
iterate to the end of them, and report nothing wrong: the program is
the only place that knows. foxenflac and microflac now refuse an input
whose stream info never came, and claxon holds its output to the frame
count STREAMINFO declares, as drflac, foxenflac, microflac and
cscoreflac already did. symphonia needs nothing: Symphonia reports
"unexpected end of file" there itself.

scripts/decoder-smoke.sh gains two rows for every program, neither of
which may exit 0: the 16-bit stream cut to its first three bytes, and
cut at a frame boundary. On darwin-arm64 the first fails on foxenflac
before this change and the second on claxon.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: closer-claudio <claudio@farcloser.world>
@closer-claudio

Copy link
Copy Markdown
Contributor Author

Reviewed at d8e4c83

@closer-claudio
closer-claudio merged commit 4ff28f3 into main Nov 22, 2026
27 checks passed
@closer-claudio
closer-claudio deleted the claudio/20261121-decoder-ends branch November 22, 2026 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants