Skip to content

gh-153692: Raise wave.Error for a truncated fmt chunk in wave.open#153693

Open
tonghuaroot wants to merge 2 commits into
python:mainfrom
tonghuaroot:wave-fmt-eof
Open

gh-153692: Raise wave.Error for a truncated fmt chunk in wave.open#153693
tonghuaroot wants to merge 2 commits into
python:mainfrom
tonghuaroot:wave-fmt-eof

Conversation

@tonghuaroot

@tonghuaroot tonghuaroot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

wave.open(f, 'rb') is documented to raise wave.Error for a file that
violates the WAV format, but Wave_read.initfp() let the EOFError raised by
_read_fmt_chunk() on a truncated fmt chunk escape raw. Wrap that call so a
truncated fmt chunk raises wave.Error, matching every other malformed-input
path in the module.

wave.open(f, 'rb') is documented to raise wave.Error for a file that violates
the WAV format, but Wave_read.initfp() let the EOFError raised by
_read_fmt_chunk() on a truncated fmt chunk escape raw. Wrap that call so a
truncated fmt chunk raises wave.Error, matching every other malformed-input
path in the module.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant