Fix computeChatChecksum returning unsigned byte for i8 schema (closes #1482)#1485
Merged
extremeheat merged 1 commit intoPrismarineJS:masterfrom May 4, 2026
Merged
Conversation
The chat_command_signed packet schema defines the checksum as i8 (-128..127), but computeChatChecksum was returning the result of '& 0xff' (0..255). When the masked value exceeded 127, sending any signed chat command crashed with RangeError on MC 1.21.11. Convert the unsigned byte to signed range before returning. Closes PrismarineJS#1482.
extremeheat
approved these changes
May 3, 2026
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
The
chat_command_signedpacket schema defines the checksum asi8(-128..127), butcomputeChatChecksumwas returning the result of& 0xff(0..255). When the masked checksum exceeded 127, the protocol writer rejected it withRangeError: The value of \"value\" is out of range. It must be >= -128 and <= 127. Received N, breaking any signed slash command on MC 1.21.11.Closes #1482.
Fix
Convert the unsigned byte to signed range before returning:
Test plan
node_modules/minecraft-protocol/src/datatypes/checksums.jswith the same conversion against MC 1.21.11 vanilla server (LAN), bot has been sending/say//tellfor ~14 days without RangeError.Notes
Issue #1482 has the full repro steps (versions, error, root cause). This PR is the minimal fix; the value-zero guard (
return 1) is preserved.