Repository navigation
fix/prevent-wav-5gb-alloc: Prevent integer underflow in decoder::wav::SamplesIterator::next causing 5 GB allocation when reading certain WAV files - #933
Open
marin-m wants to merge 1 commit into
Conversation
…::SamplesIterator::next` causing 5 GB allocation when reading certain WAV files
marin-m
force-pushed
the
fix/prevent-wav-5gb-alloc
branch
from
October 25, 2026 09:21
1ce4a53 to
c6b8807
Compare
kapok-4o
reviewed
Nov 25, 2026
kapok-4o
left a comment
There was a problem hiding this comment.
I reproduced #929 with a 3-sample mono WAV through Decoder::new_wav (hound feature): reading past the end and then calling size_hint() panics with "attempt to subtract with overflow" at wav.rs:176 on master, and returns (0, Some(0)) here. Could you add that as a regression test? Separately, and not from this PR: size_hint doesn't count silence_samples_remaining, so a file that ends mid-frame yields more samples than the reported upper bound.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Should fix #929 (originally reported at marin-m/SongRec#341)