Closed dragokas closed 3 years ago
Additional info: Decompiled GetMissionFirstMap
int __cdecl CTerrorGameRules::GetMissionFirstMap(CTerrorGameRules *this)
{
int v1; // eax
int v2; // eax
KeyValues *v3; // esi
int v4; // ebp
int v5; // eax
int v7; // [esp+1Ch] [ebp-30h]
KeyValues *v8; // [esp+20h] [ebp-2Ch]
if ( this )
*(_DWORD *)this = 0;
v1 = (*(int (__cdecl **)(int))(*(_DWORD *)g_pMatchFramework + 40))(g_pMatchFramework);
v2 = (*(int (__cdecl **)(int, _DWORD))(*(_DWORD *)v1 + 4))(v1, 0);
v3 = (KeyValues *)v2;
if ( !v2 )
return 0;
v8 = (KeyValues *)v2;
v4 = (*(int (__cdecl **)(int, int, CTerrorGameRules *))(*(_DWORD *)g_pMatchExtL4D + 4))(g_pMatchExtL4D, v2, this);
KeyValues::SetInt(v3, "Game/chapter", 1);
v5 = (*(int (__cdecl **)(int, KeyValues *, _DWORD))(*(_DWORD *)g_pMatchExtL4D + 4))(g_pMatchExtL4D, v3, 0);
if ( !v5 )
v5 = v4;
v7 = v5;
KeyValues::deleteThis(v8);
return v7;
}
How they are using it:
int CRestartGameIssue::ExecuteCommand()
{
char *v0; // esi
KeyValues *v1; // eax
if ( CTerrorGameRules::IsHoldoutMode() )
return Director::RestartHoldoutRound((Director *)TheDirector);
v0 = *(char **)(gpGlobals + 60);
if ( !v0 )
v0 = "";
v1 = (KeyValues *)CTerrorGameRules::GetMissionFirstMap(0);
if ( v1 )
v0 = (char *)KeyValues::GetString(v1, (const char *)&off_95D879, v0);
return Director::RestartScenarioFromVote((Director *)TheDirector, v0);
}
Fixed with VDECODE_FLAG_ALLOWWORLD SDKCall flag.
Help us help you
Environment
Description
I'd like to ask to partially revert PR#1265, that limiting the range of allowed addresses for passing to SDKCall with SDKCall_Raw type.
Here is a using sample, that works well in SM < 1.11.6584:
Problematic Code (or Steps to Reproduce)
sample.games.txt
sample.sp
From SM 1.11.6584+ it raises: ThisPtr address cannot be null I did my best to alter code trying to pass valid g_pGameRules address or zero (using SDKCall_GameRules), without success; lead to crashing. PS. The sample is used as a part of Left 4 DHooks Direct.