Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion engine/baseclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "iregistry.h"
#include "sv_main.h"
#include "hltvserver.h"
#include <memory>

#ifdef REPLAY_ENABLED
#include "replay_internal.h"
Expand Down Expand Up @@ -1153,7 +1154,9 @@ void CBaseClient::SendSnapshot( CClientFrame *pFrame )

bool bFailedOnce = false;
write_again:
bf_write msg( "CBaseClient::SendSnapshot", m_SnapshotScratchBuffer, sizeof( m_SnapshotScratchBuffer ) );
// RaphaelIT7: Were deep in networking and the stack can easily get close to an overflow
static thread_local std::unique_ptr<unsigned int> pSnapshotScratchBuffer(new unsigned int[g_nScratchBufferSizeAsInt]);
bf_write msg( "CBaseClient::SendSnapshot", pSnapshotScratchBuffer.get(), SNAPSHOT_SCRATCH_BUFFER_SIZE );

TRACE_PACKET( ( "SendSnapshot(%d)\n", pFrame->tick_count ) );

Expand Down
3 changes: 1 addition & 2 deletions engine/baseclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,7 @@ class CBaseClient : public IGameEventListener2, public IClient, public IClientMe
{
SNAPSHOT_SCRATCH_BUFFER_SIZE = 160000,
};

unsigned int m_SnapshotScratchBuffer[ SNAPSHOT_SCRATCH_BUFFER_SIZE / 4 ];
static constexpr int g_nScratchBufferSizeAsInt = SNAPSHOT_SCRATCH_BUFFER_SIZE / sizeof(unsigned int);

private:
void StartTrace( bf_write &msg );
Expand Down