Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
…low_EmbedMediaDesc_parser
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.
Changes in this pull request
Security Fix: Index Out-of-Bounds issue in
read_embedded_media_desc_boxon parsing JUMBF EmbedMediaDesc BoxIssue
BoxReader::read_embedded_media_desc_box(sdk/src/jumbf/boxes.rs) crashes when parsing a craftedbfdbbox withsize=9(8-byte BMFF header + 1-byte toggles, no media type data).data_len = size - HEADER_SIZE - TOGGLE_SIZE = 9 - 8 - 1 = 0causesread_to_vec(0)to return an empty buffer. The_match arm then evaluatesbuf[buf.len() - 1]wherebuf.len() = 0, causing ausizeunderflow and an index-out-of-bounds panic in both debug and release builds.Fix
Minimum size guard — rejects any
bfdbbox withsize < 9(HEADER_SIZE + TOGGLE_SIZE) before any reads, preventingu64underflow in thedata_lencomputation for boxes smaller than a toggles-only payload.Safe last-byte access — replaced
buf[buf.len() - 1]withbuf.last(), which returnsNonefor an empty slice and safely handles thesize=9empty media type case.Test
embedded_media_desc_box_handles_empty_media_type_and_rejects_undersized:sizeOkbuf.last()Errdata_lenunderflows without minimum size guardErrChecklist
TO DOitems (or similar) have been entered as GitHub issues and the link to that issue has been included in a comment.