ddnet/src
Robert Müller 151b2854e3 Fix potential client crash when console backlog is full
Fix backlog corruption in `CConsole::PumpBacklogPending` when many backlog entries are allocated at the same time. When allocating many entries from the `m_Backlog` ringbuffer at the same time, the first entries being allocated may already have been recycled again, so the pointers to them being stored in the temporary vector of new backlog entries were pointing arbitrarily into the ringbuffer data, which could cause corruption of the structural and user data of the ringbuffer. Now, we iterate over the entire backlog and only update uninitialized entries instead of storing the new entries separately.

This was sometimes caught as a misaligned access with UBSan:

```
src/engine/shared/ringbuffer.cpp:160:14: runtime error: member access within misaligned address 0x00014126f4df for type 'struct CItem', which requires 8 byte alignment
0x00014126f4df: note: pointer points here
<memory cannot be printed>
    0 0x5825349a6a1c in CRingBufferBase::Prev(void*) src/engine/shared/ringbuffer.cpp:160
    1 0x5825334e8934 in CTypedRingBuffer<CGameConsole::CInstance::CBacklogEntry>::Prev(CGameConsole::CInstance::CBacklogEntry*) src/engine/shared/ringbuffer.h:59
    2 0x5825334d13e6 in CGameConsole::OnRender() src/game/client/components/console.cpp:1259
    3 0x582533bce058 in CGameClient::OnRender() src/game/client/gameclient.cpp:715
    4 0x582532f3cc44 in CClient::Render() src/engine/client/client.cpp:894
    5 0x582532f9d236 in CClient::Run() src/engine/client/client.cpp:2971
    6 0x582533002e5e in main src/engine/client/client.cpp:4523
```
2024-04-21 12:52:54 +02:00
..
android Add tests for overloaded hash operators, use operator instead 2022-11-12 20:36:38 +01:00
antibot Rename all variables for strict camel-casing of abbreviations 2024-03-05 15:44:09 +01:00
base Fix assertion on Windows when redirecting console output to nul 2024-04-17 20:00:32 +02:00
engine Merge pull request #8203 from Robyt3/Graphics-LoadPng-Cleanup 2024-04-20 00:55:02 +00:00
game Fix potential client crash when console backlog is full 2024-04-21 12:52:54 +02:00
macos Add INotifications kernel interface 2023-12-16 18:15:43 +01:00
masterping update ci actions, update rust edition to 2021 since our MSRV covers it 2024-02-25 15:55:10 +01:00
mastersrv update ci actions, update rust edition to 2021 since our MSRV covers it 2024-02-25 15:55:10 +01:00
rust-bridge Rename all variables for strict camel-casing of abbreviations 2024-03-05 15:44:09 +01:00
steam Rename all variables for strict camel-casing of abbreviations 2024-03-05 15:44:09 +01:00
test Revert "Record player name in Teehistorian files" 2024-04-16 12:41:14 +08:00
tools Change PNG in function names to Png 2024-04-12 17:23:18 +02:00