Conversation
Signed-off-by: Robert McConnell <robert@mcc0nnell.org>
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.
Summary
Validate public
ogg_pagelengths beforeogg_page_checksum_set()zeros the checksum field or passes them into the internal CRC loop.Details
ogg_pagestoresheader_lenandbody_lenaslong, while_os_update_crc()takes anint size. Currentmaindoes not validate either length before the conversion.Two standalone sanitizer repros demonstrate the failure on current
main(06a5e026):header_len = -1enters_os_update_crc()with a negativesize; thewhile(size--)loop walks past the supplied header and ASan reports a stack-buffer-overflow read.header_len = INT_MAX + 1narrows toINT_MIN; UBSan reports signed overflow in the decrement and ASan then reports the same out-of-bounds read.The fix rejects null/short headers, negative lengths, lengths that cannot be represented by the CRC helper, and nonzero body lengths with a null body pointer before mutating the checksum bytes.
Validation
test_framingunder Clang ASan + UBSan: pass-Wall -Wextra -Werror: passgit diff --check: passBoundary note: normal pages produced by libogg framing have bounded lengths. This patch hardens the public checksum API for caller-constructed or mutated
ogg_pagevalues; it is not presented as malformed-wire reachability.Signed-off-by: Robert McConnell robert@mcc0nnell.org