From 1b32e47173443aec97773aac82de9985ec31bf7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Fri, 22 Jul 2022 16:42:56 +0200 Subject: [PATCH] Fix shift with negative exponent in `TeamMask` ``` src/game/server/teams.cpp:484:35: runtime error: shift exponent -1 is negative 0x55d065b241c4 in CGameTeams::TeamMask(int, int, int) src/game/server/teams.cpp:484 0x55d0657f92ed in CCharacter::TickDefered() src/game/server/entities/character.cpp:821 0x55d065a5d04c in CGameWorld::Tick() src/game/server/gameworld.cpp:283 0x55d0659327e6 in CGameContext::OnTick() src/game/server/gamecontext.cpp:852 0x55d0656e6a88 in CServer::Run() src/engine/server/server.cpp:2807 0x55d0657164f1 in main src/engine/server/server.cpp:3904 ``` --- src/game/server/teams.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/game/server/teams.cpp b/src/game/server/teams.cpp index ef3494c7b..9de01fddc 100644 --- a/src/game/server/teams.cpp +++ b/src/game/server/teams.cpp @@ -478,11 +478,14 @@ bool CGameTeams::TeamFinished(int Team) int64_t CGameTeams::TeamMask(int Team, int ExceptID, int Asker) { - int64_t Mask = 0; - if(Team == TEAM_SUPER) + { + if(ExceptID == -1) + return 0xffffffffffffffff; return 0xffffffffffffffff & ~(1 << ExceptID); + } + int64_t Mask = 0; for(int i = 0; i < MAX_CLIENTS; ++i) { if(i == ExceptID)