Skip to content

Commit

Permalink
Fix out of bounds access with highlighted messages in server demos
Browse files Browse the repository at this point in the history
```
src/game/client/components/chat.cpp:795:89: runtime error: index -1 out of bounds for type 'CClientData [64]'
    #0 0x55c133fd047a in CChat::AddLine(int, int, char const*) src/game/client/components/chat.cpp:795
    #1 0x55c133fc80b5 in CChat::OnMessage(int, void*) src/game/client/components/chat.cpp:570
    #2 0x55c134677688 in CGameClient::OnMessage(int, CUnpacker*, int, bool) src/game/client/gameclient.cpp:770
    #3 0x55c133c282d2 in CClient::OnDemoPlayerMessage(void*, int) src/engine/client/client.cpp:2627
    #4 0x55c134ccdcba in CDemoPlayer::DoTick() src/engine/shared/demo.cpp:679
    #5 0x55c134cdac81 in CDemoPlayer::Update(bool) src/engine/shared/demo.cpp:1007
    #6 0x55c133c2a08b in CClient::Update() src/engine/client/client.cpp:2686
    #7 0x55c133c4c9eb in CClient::Run() src/engine/client/client.cpp:3296
    #8 0x55c133cbd64f in main src/engine/client/client.cpp:4761
```
  • Loading branch information
Robyt3 committed Jul 21, 2022
1 parent b4eee12 commit 95636da
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/game/client/components/chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine)
{
// on demo playback use local id from snap directly,
// since m_aLocalIDs isn't valid there
if(LineShouldHighlight(pLine, m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientID].m_aName))
if(m_pClient->m_Snap.m_LocalClientID >= 0 && LineShouldHighlight(pLine, m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientID].m_aName))
Highlighted = true;
}

Expand Down

0 comments on commit 95636da

Please sign in to comment.