maps: fix in load n64jam_doomshakalaka

Checks entid is bigger than maximum number of entities.

https://www.moddb.com/games/quake-2/addons/quake-2-re-release-n64-sp-map-jam
This commit is contained in:
Denis Pauk 2024-08-25 19:20:11 +03:00
parent 45fce1deb0
commit 758961a848
5 changed files with 21 additions and 9 deletions

View file

@ -54,7 +54,8 @@ CL_AddMuzzleFlash(void)
if ((i < 1) || (i >= MAX_EDICTS)) if ((i < 1) || (i >= MAX_EDICTS))
{ {
Com_Error(ERR_DROP, "CL_AddMuzzleFlash: bad entity"); Com_Error(ERR_DROP, "%s: bad entity %d >= %d\n",
__func__, i, MAX_EDICTS);
} }
weapon = MSG_ReadByte(&net_message); weapon = MSG_ReadByte(&net_message);
@ -334,14 +335,15 @@ CL_AddMuzzleFlash2(void)
if ((ent < 1) || (ent >= MAX_EDICTS)) if ((ent < 1) || (ent >= MAX_EDICTS))
{ {
Com_Error(ERR_DROP, "CL_AddMuzzleFlash2: bad entity"); Com_Error(ERR_DROP, "%s: bad entity %d >= %d\n",
__func__, ent, MAX_EDICTS);
} }
flash_number = MSG_ReadByte(&net_message); flash_number = MSG_ReadByte(&net_message);
if (flash_number > 210) if (flash_number > 210)
{ {
Com_DPrintf("CL_AddMuzzleFlash2: bad offset"); Com_DPrintf("%s: bad offset\n", __func__);
return; return;
} }

View file

@ -864,7 +864,8 @@ CL_GetEntitySoundOrigin(int ent, vec3_t org)
if ((ent < 0) || (ent >= MAX_EDICTS)) if ((ent < 0) || (ent >= MAX_EDICTS))
{ {
Com_Error(ERR_DROP, "CL_GetEntitySoundOrigin: bad ent"); Com_Error(ERR_DROP, "%s: bad entity %d >= %d\n",
__func__, ent, MAX_EDICTS);
} }
old = &cl_entities[ent]; old = &cl_entities[ent];
@ -881,7 +882,8 @@ CL_GetEntitySoundVelocity(int ent, vec3_t vel)
if ((ent < 0) || (ent >= MAX_EDICTS)) if ((ent < 0) || (ent >= MAX_EDICTS))
{ {
Com_Error(ERR_DROP, "CL_GetEntitySoundVelocity: bad ent"); Com_Error(ERR_DROP, "%s: bad entity %d >= %d\n",
__func__, ent, MAX_EDICTS);
} }
old = &cl_entities[ent]; old = &cl_entities[ent];

View file

@ -380,12 +380,13 @@ CL_ParsePacketEntities(frame_t *oldframe, frame_t *newframe)
if (newnum >= MAX_EDICTS) if (newnum >= MAX_EDICTS)
{ {
Com_Error(ERR_DROP, "CL_ParsePacketEntities: bad number:%i", newnum); Com_Error(ERR_DROP, "%s: bad entity %d >= %d\n",
__func__, newnum, MAX_EDICTS);
} }
if (net_message.readcount > net_message.cursize) if (net_message.readcount > net_message.cursize)
{ {
Com_Error(ERR_DROP, "CL_ParsePacketEntities: end of message"); Com_Error(ERR_DROP, "%s: end of message", __func__);
} }
if (!newnum) if (!newnum)
@ -1192,7 +1193,8 @@ CL_ParseStartSoundPacket(void)
if (ent > MAX_EDICTS) if (ent > MAX_EDICTS)
{ {
Com_Error(ERR_DROP, "CL_ParseStartSoundPacket: ent = %i", ent); Com_Error(ERR_DROP, "%s: bad entity %d >= %d\n",
__func__, ent, MAX_EDICTS);
} }
channel &= 7; channel &= 7;

View file

@ -444,7 +444,8 @@ MSG_WriteDeltaEntity(entity_state_t *from,
if (to->number >= MAX_EDICTS) if (to->number >= MAX_EDICTS)
{ {
Com_Error(ERR_FATAL, "Entity number >= MAX_EDICTS"); Com_Error(ERR_DROP, "%s: bad entity %d >= %d\n",
__func__, to->number, MAX_EDICTS);
} }
/* send an update */ /* send an update */

View file

@ -122,6 +122,11 @@ SV_CreateBaseline(void)
/* take current state as baseline */ /* take current state as baseline */
VectorCopy(svent->s.origin, svent->s.old_origin); VectorCopy(svent->s.origin, svent->s.old_origin);
if (entnum >= MAX_EDICTS)
{
Com_Error(ERR_DROP, "%s: bad entity %d >= %d\n",
__func__, entnum, MAX_EDICTS);
}
sv.baselines[entnum] = svent->s; sv.baselines[entnum] = svent->s;
} }
} }