Repository navigation
Conversation
A 32-bit shift turned 4294967296 into an all-zero script number.
Author
|
You're right. #2335 is the older fix and it already has the negative fixture. Closing this one. |
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
scriptNumber.encode(4294967296)returned0000000000. The shiftvalue >>= 8keeps 32 bits, so the high byte of a 5-byte script number was dropped.8589934591came back asffffffff00instead offfffffff01.The loop now divides by 256. Existing fixtures are unchanged, including
4294967295asffffffff00.Test plan
encode(4294967296)was0000000000andencode(8589934591)wasffffffff00.npx mocha test/script_number.spec.ts: 112 passing, including the two new fixtures (0000000001andffffffff01).Made with Cursor