Repository navigation
framing: validate page lengths before decomposition - #112
Open
mcc0nnell wants to merge 2 commits into
Open
mcc0nnell wants to merge 2 commits into
mcc0nnell wants to merge 2 commits into
Conversation
Signed-off-by: Robert McConnell <robert@mcc0nnell.org>
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
ogg_pageheader/body lengths beforeogg_stream_pagein()reads fixed header fields or decomposes the lacing table.Details
Two malformed public
ogg_pageinputs reproduce memory-safety failures on currentmain(06a5e026):header_len = 1reachesogg_page_version()and ASan reports a stack-buffer-overflow read;body_len = 0but one lacing value of255drivesbodysizenegative while skipping a continued packet, then reachesmemcpy()with a negative size; ASan reportsnegative-size-param.This change rejects null/short page headers, negative body lengths, truncated segment tables, body lengths that do not match the lacing table, and a nonzero body length with a null body pointer.
The built-in framing self-test covers the short-header and lacing/body mismatch cases.
Validation
test_framingunder Clang ASan + UBSan: pass-1with this patch-Wall -Wextra -Werror: passBoundary note: pages produced through the normal sync parser already carry consistent lengths. This patch hardens the public
ogg_stream_pagein()boundary for callers that supply anogg_pagedirectly.Signed-off-by: Robert McConnell robert@mcc0nnell.org