-
-
Notifications
You must be signed in to change notification settings - Fork 461
Guard GameConf Access During Client Initialization #2401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Guard GameConf Access During Client Initialization #2401
Conversation
Prevent crash on Source 2007 forks where GetPlayerNetInfo()->GetMsgHandler() is not compatible with IClient. Only attempt the netchan/IClient path for known-safe game folders; otherwise leave m_pIClient null.
his is a follow-up to PR alliedmodders#2397 (Guard IClient Netchan Path by Gamedata). While that change prevents the netchan crash, testing on Source 2007–based forks showed the server can still crash during early client initialization when gamedata is accessed before it’s available. This adds a small guard around g_pGameConf key lookups so missing gamedata is treated as “unset,” preserving default behavior while preventing an access violation.
|
Crash ID: N66Z-JZGG-6QEI 1.4.8 and 1.5.2 were the last SM versions that worked on Kuma, because they didn’t depend on gamedata/Steam-ID plumbing at connect time. My concern if these two lines are merged is I don't know yet if inside |
Kenzzer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to need clarification on what you meant by
via g_pGameConf, which is not guaranteed to be available on some Source 2007–based engine forks
g_pGameConf is absolutely available by the time the hook on IServerGameClients::ClientConnect. The only reason it wouldn't be is if the file was missing.
Loaded here as sourcemod boots up :
sourcemod/core/logic/GameConfigs.cpp
Lines 1135 to 1139 in 8907569
| void GameConfigManager::OnSourceModStartup(bool late) | |
| { | |
| m_gameBinPathManager.Init(); | |
| LoadGameConfigFile("core.games", &g_pGameConf, NULL, 0); |
Retrieved here as sourcemod initializes itself :
Lines 313 to 321 in 8907569
| g_pGameConf = logicore.GetCoreGameConfig(); | |
| sCoreProviderImpl.InitializeHooks(); | |
| /* Notify! */ | |
| pBase = SMGlobalClass::head; | |
| while (pBase) | |
| { | |
| pBase->OnSourceModAllInitialized(); |
Definitively available by the time
OnSourceModAllInitialized is invoked and the hook gets setup.sourcemod/core/PlayerManager.cpp
Lines 165 to 167 in e050532
| void PlayerManager::OnSourceModAllInitialized() | |
| { | |
| SH_ADD_HOOK(IServerGameClients, ClientConnect, serverClients, SH_MEMBER(this, &PlayerManager::OnClientConnect), false); |
This is a follow-up to PR #2397. While the IClient/netchan guard fixed the original crash, the server still crashes during CPlayer::Initialize() at the UpdateAuthIds() call. The issue is that UpdateAuthIds() reads gamedata via g_pGameConf, which is not guaranteed to be available on some Source 2007–based engine forks. This adds a small guard so missing gamedata is treated as unset instead of causing an access violation.