From a9374f068bbb696249dcd73ef8a0e10ca73447d5 Mon Sep 17 00:00:00 2001 From: smallmodel <15067410+smallmodel@users.noreply.github.com> Date: Thu, 17 Aug 2023 18:24:50 +0200 Subject: [PATCH] Added a check to avoid packed from being out of bounds in MSG_PackCoord() --- code/qcommon/msg.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/qcommon/msg.cpp b/code/qcommon/msg.cpp index f83ac0bb..9ce52802 100644 --- a/code/qcommon/msg.cpp +++ b/code/qcommon/msg.cpp @@ -2157,7 +2157,11 @@ int MSG_PackAlpha(float alpha, int bits) int MSG_PackCoord(float coord) { unsigned int packed = (unsigned int)round(coord * 4.0 + MAX_PACKED_COORD_HALF); - coordstats[packed]++; + if (packed >= MAX_PACKED_COORD) { + Com_DPrintf("Illegal XYZ coordinates for an entity, small information lost in transmission\n"); + } else { + coordstats[packed]++; + } return packed; }