mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-07-27 07:31:49 +03:00
Guard Squirrel constructor_stub() invocations from invalid class parameters
This prevents manual invocations of the native class constructor for non-class values or non-native classes.
This commit is contained in:
parent
655679e7da
commit
ca7bc5da57
@ -1548,7 +1548,15 @@ SQInteger destructor_stub_instance(SQUserPointer p, SQInteger size)
|
||||
SQInteger constructor_stub(HSQUIRRELVM vm)
|
||||
{
|
||||
ScriptClassDesc_t* pClassDesc = nullptr;
|
||||
sq_gettypetag(vm, 1, (SQUserPointer*)&pClassDesc);
|
||||
if (SQ_FAILED(sq_gettypetag(vm, 1, (SQUserPointer*)&pClassDesc)))
|
||||
{
|
||||
return sq_throwerror(vm, "Expected native class");
|
||||
}
|
||||
|
||||
if (!pClassDesc || (void*)pClassDesc == TYPETAG_VECTOR)
|
||||
{
|
||||
return sq_throwerror(vm, "Unable to obtain native class description");
|
||||
}
|
||||
|
||||
if (!pClassDesc->m_pfnConstruct)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user