OpenJK
OpenJK copied to clipboard
Client crash when connecting to server that spawned too many different types of npcs
Operating system and version: Pretty sure it's OS agnostic, but can reliably reproduce on Windows client (with any OS version) at least.
Is this for single player or multiplayer? Multiplayer
Description of the bug (and if possible, steps to reproduce the bug): This bug is as old as the internet, but still seems like a good idea to address: when spawning more than 16 different types of npcs on one map (not too many npcs contrary to popular belief - too many npc types), without changing to a different map in between, all clients crash, and reconnecting to the server will also cause an instant client crash.
To reproduce, simply keep spawning different types of npcs until the OpenJK client crashes. This affects non-OpenJK clients too. The bug occurs even if all npcs are killed.
What did you expect to happen instead? The OpenJK client should not crash and should enter the game normally even if >16 npc types have been spawned.
Exactly 16 types means its related to hardcoded cap of 16 G2 gore things I think.
Can confirm, spawning too many NPCs will cause the game to crash (at some point). In debug build it hits an assert. In release, I imagine it's reading/writing outside the bounds of the bgAllEvents
array in bg_panimate.c
. Stack trace:
msvcr120d.dll!_wassert(const wchar_t * expr=0x1022a4a0, const wchar_t * filename=0x1022a3e8, unsigned int lineno=2155) Line 369 C
> cgamex86.dll!BG_ParseAnimationEvtFile(const char * as_filename=0x0018f6d4, int animFileIndex=0, int eventFileIndex=16) Line 2155 C
cgamex86.dll!CG_G2AnimEntModelLoad(centity_s * cent=0x109af49c) Line 7303 C
cgamex86.dll!CG_G2Animated(centity_s * cent=0x109af49c) Line 7512 C
cgamex86.dll!CG_AddCEntity(centity_s * cent=0x109af49c) Line 3382 C
cgamex86.dll!CG_AddPacketEntities(qboolean_e isPortal=qfalse) Line 3516 C
cgamex86.dll!CG_DrawActiveFrame(int serverTime=634442, int stereoView=0, qboolean_e demoPlayback=qfalse) Line 2639 C
I can get the assert to happen but not the crash in debug.