From cfaef2bf115537b87828cebbcef7141247722868 Mon Sep 17 00:00:00 2001 From: Spoike Date: Mon, 20 Dec 2021 10:08:01 +0000 Subject: [PATCH] Refuse to load maps exceeding the bsp29 clipnode limit. This avoids possible infinite loops or other weirdness in favour of a clear error. The QBSP really ought to be doing this too. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6146 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/gl/gl_model.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engine/gl/gl_model.c b/engine/gl/gl_model.c index 26a3d6a9..c48a26e8 100644 --- a/engine/gl/gl_model.c +++ b/engine/gl/gl_model.c @@ -4691,6 +4691,11 @@ static qboolean Mod_LoadClipnodes (model_t *loadmodel, qbyte *mod_base, lump_t * Con_Printf (CON_ERROR "MOD_LoadBmodel: funny lump size in %s\n",loadmodel->name); return false; } + if (count > (1u<<16)) + { + Con_Printf (CON_ERROR "%s: clipnode count exceeds 16bit limit (%u). Try bsp2.\n", loadmodel->name, count); + return false; + } } out = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*out));//space for both