Fix bit overflows when writing headers#3439
Merged
lu-zero merged 1 commit intoxiph:masterfrom Jun 11, 2025
Merged
Conversation
sdroege
commented
Jun 11, 2025
| bw.write_bit(true)?; // marker | ||
| bw.write(7, 1)?; // version | ||
| bw.write(3, seq.profile)?; | ||
| bw.write(5, 31)?; // level |
Contributor
Author
There was a problem hiding this comment.
Specifically, this line was always panicking for me.
Unclear why the CI / tests here are not catching that.
`bw.write(5, 31)` is writing an 31i32 but that doesn't fit into 5 bits because of the sign bit. As part of this, also move everything to the non-compat `BitWrite` trait.
d0dc232 to
0b8af98
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3439 +/- ##
==========================================
- Coverage 88.52% 82.31% -6.22%
==========================================
Files 89 84 -5
Lines 28323 27086 -1237
==========================================
- Hits 25074 22296 -2778
- Misses 3249 4790 +1541 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
lu-zero
approved these changes
Jun 11, 2025
Collaborator
lu-zero
left a comment
There was a problem hiding this comment.
Thank you! I'll roll a 0.8.1 with it this weekend.
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.
bw.write(5, 31)is writing an 31i32 but that doesn't fit into 5 bits because of the sign bit.As part of this, also move everything to the non-compat
BitWritetrait.