Conversation
Signed-off-by: Robert McConnell <robert@mcc0nnell.org>
The initial modulo-32-bit fix still lets the valid 0xffffffff page number collide with the pageno==-1 reset sentinel on ILP32. That can make the encoder skip page 0xffffffff and can suppress a decoder hole when that page is missing.\n\nStore 32-bit page numbers with a defined long mapping, distinguish decoder sequence initialization from reset state, and extend the rollover regression to cover both contiguous wrap and a dropped 0xffffffff page. 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
Keep Ogg page sequence-number arithmetic in the 32-bit unsigned domain used by the wire format, including rollover on 32-bit
longplatforms.Details
Current
mainstores the page sequence number inlongand increments it with signed arithmetic.That causes several observable problems:
0xffffffffstores the next expected page as0x100000000; a valid following page0is then treated as a discontinuity andogg_stream_packetout()reports a false hole;0xffffffffmaps to signed-1, which collides with libogg's existingpageno == -1reset sentinel. Without distinguishing those states, the encoder can skip page0xffffffff, and the decoder can suppress a hole when that page is actually missing.The change keeps page-number comparison and increment in
ogg_uint32_t, uses a defined mapping when storing the value back in the existinglongfield, and keeps reset state distinct from an initialized decoder sequence without changing the public struct layout.Regression coverage exercises both a contiguous
0xfffffffd -> 0xfffffffe -> 0xffffffff -> 0transition and a dropped0xffffffffpage across rollover.Validation
-Wall -Wextra -Werror: pass-Wall -Wextra -Werror: pass-Wall -Wextra -Werror: pass0xfffffffe, 0; missing0xffffffffis not reported as a hole0xfffffffe, 0xffffffff; missing0xffffffffreports exactly one holeSigned-off-by: Robert McConnell robert@mcc0nnell.org