Skip to content

Commit a9a72a4

Browse files
author
ikrima
committed
Add assert check to make sure we stack allocate enough memory in ufunction_call
1 parent df6f520 commit a9a72a4

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Source/UnrealEnginePython/Private/UEPyModule.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3023,7 +3023,10 @@ PyObject *py_ue_ufunction_call(UFunction *u_function, UObject *u_obj, PyObject *
30233023
}
30243024
}
30253025

3026-
//TODO: rdeioris: Should assert warn if u_funciton->ParmsSize != u_function->PropertiesSize bc it overflowed
3026+
if (u_function->PropertiesSize > u_function->ParmsSize)
3027+
{
3028+
return PyErr_Format(PyExc_Exception, "UFunction PropertiesSize (%i) > ParmsSize (%i).", u_function->PropertiesSize, u_function->ParmsSize);
3029+
}
30273030
uint8 *buffer = (uint8 *)FMemory_Alloca(u_function->ParmsSize);
30283031
FMemory::Memzero(buffer, u_function->ParmsSize);
30293032

@@ -3034,7 +3037,7 @@ PyObject *py_ue_ufunction_call(UFunction *u_function, UObject *u_obj, PyObject *
30343037
UProperty *prop = *IArgs;
30353038
if (!prop->HasAnyPropertyFlags(CPF_ZeroConstructor))
30363039
{
3037-
prop->InitializeValue_InContainer(buffer);
3040+
prop->InitializeValue_InContainer(buffer);
30383041
}
30393042

30403043
#if WITH_EDITOR
@@ -3047,10 +3050,9 @@ PyObject *py_ue_ufunction_call(UFunction *u_function, UObject *u_obj, PyObject *
30473050
#else
30483051
prop->ImportText(*default_key_value, prop->ContainerPtrToValuePtr<uint8>(buffer), PPF_Localized, NULL);
30493052
#endif
3050-
}
3053+
}
30513054
#endif
3052-
3053-
}
3055+
}
30543056

30553057
Py_ssize_t tuple_len = PyTuple_Size(args);
30563058

0 commit comments

Comments
 (0)