Repository navigation
Fix LegacyPingDecoder misreading modern frames as legacy pings - #1908
Open
SendableMetatype wants to merge 1 commit into
Open
SendableMetatype wants to merge 1 commit into
SendableMetatype wants to merge 1 commit into
Conversation
Contributor
|
Possibly an unpopular opinion, but I think the legacy ping functionality should be removed altogether. Minecraft 1.7.2 was released on October 25, 2013, and Velocity doesn't support versions older than that anyway. Why maintain a feature nobody uses? |
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.
LegacyPingDecodertreats any connection that starts with0xFEas a possible legacy ping. A modern frame starts with its VarInt length, and that length starts with0xFEfor frame sizes such as 254 or 382 bytes. Unless the client sent exactlyFEorFE 01, the decoder parses the bytes as a 1.6 ping. For a modern frame,readExtended16Datathen fails with aStringIndexOutOfBoundsExceptionand the connection closes without a log message. Handshakes that carry Floodgate data hit this when the hostname length produces a 254-byte frame.Changes:
0xFA, the packet ID that every 1.6 ping starts with. Otherwise it passes the bytes to the modern decoder.FEorFE 01has arrived, the decoder waits up to 100 ms for more bytes before it answers with a 1.3 or 1.4 ping. This way, a modern frame or a 1.6 ping that arrives split after those bytes does not get answered as an older ping.The tests cover a complete modern frame, split modern frames, and both delayed legacy pings.