fix: Use correct byte representation for decimal hashing#1998
Merged
liurenjie1024 merged 1 commit intoapache:mainfrom Jan 8, 2026
Merged
Conversation
Contributor
Author
|
Hi @liurenjie1024 @Xuanwo @Fokko. Could you please review this PR and let me know if the fix makes sense? Thanks! |
Spec states that: "Decimal values are hashed using the minimum number of bytes required to hold the unscaled value as a two's complement big-endian". Prior to this fix, we would incorrectly consume leading 0xFF bytes and hash them. Now, we only consume the bytes starting with the one that is used to preserve the sign, and everything that follows that byte.
5dd3638 to
388743d
Compare
liurenjie1024
approved these changes
Jan 8, 2026
Contributor
liurenjie1024
left a comment
There was a problem hiding this comment.
Thanks @aditya-subrahmanyan for this fix!
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.
Which issue does this PR close?
What changes are included in this PR?
The spec states that:
Prior to this fix, we would incorrectly consume leading
0xFFbytes and hash them. Now, we only consume the bytes starting with the one that is used to preserve the sign, and everything that follows it.Are these changes tested?
Added unit tests for original scenario mentioned in the issue, as well as some additional cases