From 12650a25709760124a538a8b78f5b116edb3fdf5 Mon Sep 17 00:00:00 2001 From: RaphaelIT7 <64648134+RaphaelIT7@users.noreply.github.com> Date: Sun, 1 Feb 2026 10:54:08 +0100 Subject: [PATCH] engine: fix an overflow if combination of MAX_EDICT_BITS & DELTASIZE_BITS is too much --- engine/sv_ents_write.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engine/sv_ents_write.cpp b/engine/sv_ents_write.cpp index 6c497b537..3d4360581 100644 --- a/engine/sv_ents_write.cpp +++ b/engine/sv_ents_write.cpp @@ -854,7 +854,8 @@ void CBaseServer::WriteDeltaEntities( CBaseClient *client, CClientFrame *to, CCl bf_write savepos = *u.m_pBuf; // Save room for number of headers to parse, too - u.m_pBuf->WriteUBitLong ( 0, MAX_EDICT_BITS+DELTASIZE_BITS+1 ); + CBitVec pHeaderBits; // RaphaelIT7: Exists just to pass nothing to WriteBits (all bits are 0 soo it'll be fine) + u.m_pBuf->WriteBits( pHeaderBits.Base(), pHeaderBits.GetNumBits() ); // RaphaelIT7: kept it as it should be faster than 3 WriteUBitLong calls intp startbit = u.m_pBuf->GetNumBitsWritten();