fix: write the 0 holder id for inline registryEntryHolder entries - #1523
Open
u9g wants to merge 1 commit into
Open
fix: write the 0 holder id for inline registryEntryHolder entries#1523u9g wants to merge 1 commit into
u9g wants to merge 1 commit into
Conversation
The compiled writer for registryEntryHolder advanced the offset by one
byte for an inline (non-registry) entry without writing anything there,
so the holder id came out as whatever the unsafe buffer already held.
Any serverbound packet carrying such an entry was corrupt on the wire:
a 1.21.2+ client echoing an item ViaVersion gave a consumable component
with an inline sound (every sword on a ViaVersion proxy) in a
window_click sends a garbage holder id, and the backend drops the
connection ("Your connection to <server> encountered a problem").
sizeOf already counted the byte and the reader already expects 0.
Adds a test that writes into a 0xff-filled buffer, where a skipped byte
cannot pass by chance.
u9g
force-pushed
the
fix/registry-entry-holder-inline-write
branch
from
September 6, 2026 23:57
98f965c to
3e4dea2
Compare
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.
Constraints on the compiled
registryEntryHolderwriter:0followed by the entry; every byte the writer advances over is written.id + 1.sizeOfandwriteagree on the length in both cases, and the reader parses either back to the same value.Test (
test/registryEntryHolderTest.js): a 1.21.4Slotwhoseconsumablecomponent carries an inline sound is written into a0xff-filled buffer; the holder id byte must be0, the round trip must parse to the same value with the same size, and the registry case must encodeid + 1. Fails on master, passes with the change.