5651: Fix shift with negative exponent in `TeamMask` r=def- a=Robyt3

Closes #5650.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [X] Changed no physics that affect existing maps
- [X] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
This commit is contained in:
bors[bot] 2022-07-22 20:23:04 +00:00 committed by GitHub
commit 05dae670f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -478,11 +478,14 @@ bool CGameTeams::TeamFinished(int Team)
int64_t CGameTeams::TeamMask(int Team, int ExceptID, int Asker) int64_t CGameTeams::TeamMask(int Team, int ExceptID, int Asker)
{ {
int64_t Mask = 0;
if(Team == TEAM_SUPER) if(Team == TEAM_SUPER)
{
if(ExceptID == -1)
return 0xffffffffffffffff;
return 0xffffffffffffffff & ~(1 << ExceptID); return 0xffffffffffffffff & ~(1 << ExceptID);
}
int64_t Mask = 0;
for(int i = 0; i < MAX_CLIENTS; ++i) for(int i = 0; i < MAX_CLIENTS; ++i)
{ {
if(i == ExceptID) if(i == ExceptID)