Open jjdredd opened 9 years ago
See #1742 for the cause.
That was fast! I forgot how and why I made this issue. Anyway thanks.
I retested this, the crash in Steam_GSBSecure
is fixed because the engine uses a newer Steamworks version that automatically creates the game server object when accessed, but now there is another crash that happens right after that function is called:
Program received signal SIGSEGV, Segmentation fault.
Steam_GSGetSteamID () at ../engine/sv_steam3.cpp:1789
1789 ../engine/sv_steam3.cpp: No such file or directory.
(gdb) bt
#0 Steam_GSGetSteamID () at ../engine/sv_steam3.cpp:1789
#1 0xf74d0547 in SVC_GetChallenge () at ../engine/sv_main.c:3352
#2 0xf74dae05 in SV_HandleRconPacket () at ../engine/sv_main.c:9252
#3 SV_CheckForRcon () at ../engine/sv_main.c:9346
#4 0xf749ecb3 in _Host_Frame (time=time@entry=0.002218568) at ../engine/host.c:1435
#5 0xf749eed8 in Host_Frame (time=0.002218568, iState=1, stateInfo=stateInfo@entry=0xffffce7c) at ../engine/host.c:1549
#6 0xf74c92d4 in CEngine::Frame (this=0xf756f140 <g_Engine>) at ../engine/sys_engine.cpp:245
#7 0xf74c5923 in CDedicatedServerAPI::RunFrame (this=0xf756a7a0 <__g_CDedicatedServerAPI_singleton>) at ../engine/sys_dll2.cpp:1257
#8 0x08049f34 in RunServer () at ../dedicated/sys_ded.cpp:767
#9 0x08049625 in main (argc=1, argv=0xffffd0e4) at ../dedicated/sys_ded.cpp:1147
Steam_GSGetSteamID
accesses s_Steam3Server
which is null until the server actually activates, which happens when the first map is loaded.
Adding a null check in Steam_GSGetSteamID
should be enough to fix this crash:
uint64 Steam_GSGetSteamID()
{
uint64 result; // rax@2
if ( !s_Steam3Server || s_Steam3Server->m_bLanOnly )
result = 0x100000000000000LL;
else
result = s_Steam3Server->m_SteamIDGS.m_steamid.m_unAll64Bits;
return result;
}
But note that there may be other places where a crash can occur. It might be better to instead check if the server is running a map before accepting connection requests and stopping early on with an error printed to the server console (and the client if possible) to inform the server operator and client that the server isn't running a map and can't let players join.
Also note that there are 2 different game server objects; one is provided by Steamworks, the other by the engine itself.
Linux 32 bit.
debug.log
dump file http://jjdredd.github.io/crash_20150926155546_1.dmp