Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AV1: Correctly parse 5-byte leb128 size value #617

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

nwolverson
Copy link
Contributor

The parsing of leb128 size value a 2-pass approach rather than following the pseudocode in the AV1 spec, presumably for performance reasons. However while the maximum permitted value is indeed 32 bits, the input bytes accumulated in a u32 are packed 7 bits per byte, thus losing relevant bits from the first byte for 5-byte values. (I believe the leb128 value can be up to 8 bytes with leading zeroes but perhaps that case was fine).

I imagine this doesn't come up where the the only large OBU in a binary presented to webrtc-rs has the size omitted, we hit this with an encoder which sets the size on every OBU.

@rainliu
Copy link
Member

rainliu commented Oct 1, 2024

Please fix clippy/fmt warnings

@rainliu rainliu merged commit 632f8a5 into webrtc-rs:master Oct 2, 2024
4 of 5 checks passed
tubzby pushed a commit to tubzby/webrtc-rs that referenced this pull request Nov 26, 2024
* Correctly parse 5-byte leb128

* reformat
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