Repository navigation
Fall back to reliable for channelId equal to channel count - #1087
Open
jimdroberts wants to merge 1 commit into
Open
jimdroberts wants to merge 1 commit into
jimdroberts wants to merge 1 commit into
Conversation
GetFallbackChannelIdAsNeeded used > instead of >=, so a channelId equal to the channel count was passed through and indexed out of range.
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.
Problem
Sending on an unsupported channel is meant to fall back to
Channel.Reliable. That works for channel ids 3 andabove, but channel id 2 (one past the last valid channel) is passed through unchanged and throws
IndexOutOfRangeExceptioninTransportManager.SendToServer/SendToClient. It is reachable from any publicsend that takes a
Channel, for exampleServerManager.Broadcast(..., (Channel)2).Cause
Runtime/Managing/Transporting/TransportManager.cs:583:_toServerBundles.CountisCHANNEL_COUNT(2), so valid ids are 0 and 1, but2 > 2is false. The returned idthen indexes arrays sized
CHANNEL_COUNT. The first is_lowestMtus[channel]inGetLowestMTU(channelId)(line 425), reached from
SendSplitMessage. Next is_toServerBundles[channelId](line 577).NetworkConnection.SendToClienthas its own>=clamp, but the throw happens before it is reached.This is a regression from the 4.7 send-path rewrite. 4.6.x checked
channelId >= _toServerBundles.Count.Fix
Compare with
>=againstCHANNEL_COUNT, the size every array indexed afterwards uses (_lowestMtus,_toServerBundles, the connection's_toClientBundles). This also keeps the server-sideSendToClientpath fromdepending on the to-server bundle list.
Evidence
Verified by mapping of the old and new expressions (channel count 2):
Behavior change
None for valid channels. Channel id 2 now falls back to reliable like every other unsupported id, instead of
throwing.