fix: reject in-width FAST varint overflow; fix signed size thresholds - #28
Merged
Conversation
Byte-count caps from #27 still allowed N×7 payload bits into narrower registers, so forms like uint64 [0x02, eight 0x00, 0x80] decoded as 0. Reject shifts that would drop high bits. Also fix signed size() literals that were positive (0x00000000ffffffc0ll etc.), so small negatives encoded as 5+ bytes instead of the canonical 1–4 byte forms. Co-authored-by: Kaius Ruokonen <ruoka@users.noreply.github.com>
ruoka
marked this pull request as ready for review
July 28, 2026 06:41
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
[0x02, eight 0x00, 0x80]no longer becomes0, and int64[0x01, eight 0x00, 0x80]no longer wraps toINT64_MIN.size()thresholds that used positive hex literals (0x00000000ffffffc0lletc.), so small negatives encode in the canonical 1–4 bytes (e.g.-1→ff) instead of always using ≥5 bytes.Test plan
./tools/CB.sh … debug test --tags=[xson]— 427/427 passed