Skip to content

Avoid overflow in channel conversion size hints - #936

Open
voidsipp wants to merge 1 commit into
RustAudio:masterfrom
voidsipp:fix/935-channel-size-hint-overflow
Open

voidsipp wants to merge 1 commit into
RustAudio:masterfrom
voidsipp:fix/935-channel-size-hint-overflow

Conversation

@voidsipp

@voidsipp voidsipp commented Nov 3, 2026

Copy link
Copy Markdown

Mixing an unbounded mono source into stereo can overflow in ChannelCountConverter::size_hint. Large finite hints can overflow there too, causing a debug panic or a wrapped hint in release builds.

Saturate the lower-bound arithmetic and return no upper bound when that calculation overflows. Finite hints that fit keep their existing values. Added regressions through the public mixer and channel converter for unbounded sources, different channel ratios and an oversized finite upper bound.

All three regressions fail before the fix and pass in debug and release after it. The default-feature integration/unit tests and the no-default-feature suite, including doctests, pass. Formatting and strict Clippy for the library and new tests pass. Full all-target Clippy on Rust 1.99 reports two existing chunks_exact warnings in tests/seek.rs.

Fixes #935.

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.

size_hint overflow panic for unbounded source

1 participant