JACoders / OpenJK

Community effort to maintain and improve Jedi Academy (SP & MP) + Jedi Outcast (SP only) released by Raven Software
GNU General Public License v2.0
1.98k stars 607 forks source link

game: fix overflow on too many spawnpoints #1138

Closed mrwonko closed 1 year ago

mrwonko commented 1 year ago

Previously, the game would typically just crash due to stack corruption after a buffer overflow. Now, we detect the overflow, and show an error instead.

Can be tested using https://mrwonko.de/jk3files/Jedi%20Academy/Maps/Free%20For%20All/82455/.

Fixes #1137

SomaZ commented 1 year ago

I'd prefer it to break the while loop and show a warning in the console instead of erorring out completely.

bartrpe commented 1 year ago

I'd prefer it to break the while loop and show a warning in the console instead of erorring out completely.

yeah, I think that's the best direction to take

ensiform commented 1 year ago

Wouldn't it be better to copy the MP code?

There is no error, it just falls back to a spawn that could "telefrag" but only thing you could telefrag in SP is an NPC I guess...

https://github.com/JACoders/OpenJK/blob/master/codemp/game/g_client.c#L654-L668