If you create a custom gametype that allows spectating on Emerald Hunt maps, spectators can trigger segfaults by simply joining the game. This happens because spectators have one single tic where player->mo
is NULL
while joining, which is enough to trigger a NULL
-dereference in the Emerald Hunt HUD logic used to detect the distance from an emerald.
This SOC can be used to trigger the bug:
GameType Spectator test
TypeOfLevel = Coop
Identifier = "spectest"
Rules = GTR_CAMPAIGN|GTR_LIVES|GTR_FRIENDLY|GTR_SPAWNENEMIES|GTR_ALLOWEXIT|GTR_EMERALDHUNT|GTR_EMERALDTOKENS|GTR_SPECIALSTAGES|GTR_CUTSCENES|GTR_SPECTATORS|GTR_NOSPECTATORSPAWN
HeaderColor = 133
RankingType = GT_COOP
IntermissionType = int_coop
Description = ""
#
To reproduce: