Signed overflow is undefined in CSnapshot::Crc

src/engine/shared/snapshot.cpp:72:8: runtime error: signed integer overflow: -1297193910 + -1824658838 cannot be represented in type 'int'
    #0 0x565165b0687d in CSnapshot::Crc() /media/ddnet/src/engine/shared/snapshot.cpp:72:8
    #1 0x565165c4d20b in CClient::ProcessServerPacket(CNetChunk*) /media/ddnet/src/engine/client/client.cpp:1981:49
    #2 0x565165c5d960 in CClient::PumpNetwork() /media/ddnet/src/engine/client/client.cpp:2589:6
    #3 0x565165c67a71 in CClient::Update() /media/ddnet/src/engine/client/client.cpp:2856:2
    #4 0x565165c72f4e in CClient::Run() /media/ddnet/src/engine/client/client.cpp:3237:4
    #5 0x565165c94b7e in main /media/ddnet/src/engine/client/client.cpp:4341:11
    #6 0x7fba5af2c151 in __libc_start_main (/usr/lib/libc.so.6+0x28151)
    #7 0x5651659e1e0d in _start (/media/ddnet/DDNet+0x705e0d)
This commit is contained in:
def 2020-10-10 12:30:02 +02:00
parent e6b0283722
commit 346853e817
3 changed files with 5 additions and 5 deletions

View file

@ -1872,7 +1872,7 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket)
int GameTick = Unpacker.GetInt();
int DeltaTick = GameTick - Unpacker.GetInt();
int PartSize = 0;
int Crc = 0;
unsigned int Crc = 0;
int CompleteSize = 0;
const char *pData = 0;
@ -2160,7 +2160,7 @@ void CClient::ProcessServerPacketDummy(CNetChunk *pPacket)
int GameTick = Unpacker.GetInt();
int DeltaTick = GameTick - Unpacker.GetInt();
int PartSize = 0;
int Crc = 0;
unsigned int Crc = 0;
int CompleteSize = 0;
const char *pData = 0;

View file

@ -59,9 +59,9 @@ int CSnapshot::GetItemIndex(int Key)
return -1;
}
int CSnapshot::Crc()
unsigned CSnapshot::Crc()
{
int Crc = 0;
unsigned int Crc = 0;
for(int i = 0; i < m_NumItems; i++)
{

View file

@ -47,7 +47,7 @@ public:
int GetItemIndex(int Key);
int GetItemType(int Index);
int Crc();
unsigned Crc();
void DebugDump();
static void RemoveExtraInfo(unsigned char *pData);
};