bugfix(replay): Stop dereferencing a null slot when a replay has no local player - #3240
Draft
bobtista wants to merge 3 commits into
Draft
Conversation
|
FWIW, GeneralsOnline does something similar: https://github.com/GeneralsOnlineDevelopmentTeam/GameClient/blob/fde347843c9c393716667ba4cee8afad1b276d45/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp#L1198-L1200 |
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.
A replay whose local player index is
-1dereferenced a missing slot in two places.RecorderClass::playbackFileread the local slot to tell a network game from a local one, andGameLogic::startNewGameread it again to mark the local player.readReplayHeaderaccepts-1andGameInfo::getSlotreturnsnullptrfor a negative slot, so such a replay crashed before it could play.Now the replay CRC queue is primed from the recorded game mode, which answers the network question directly and keeps the CRC alignment a network replay needs, and the local slot lookup during game start treats a missing local slot as no slot being local.
Verified with a replay byte-edited to carry
-1: it crashes before the change and plays to completion after it. Twelve unmodified replays produce identical CRC results before and after.Todo:
z_generalsandg_generals)