Fix crash in CloneArray for too large arrays (#566)

If there is not enough memory to clone an array, throw an error instead
of crashing the server.
This commit is contained in:
peace-maker
2016-12-11 20:55:11 -08:00
committed by Kyle Sanderson
parent d3d16a93cf
commit b74573fa12
2 changed files with 10 additions and 0 deletions
+4
View File
@@ -503,6 +503,10 @@ static cell_t CloneArray(IPluginContext *pContext, const cell_t *params)
}
ICellArray *array = oldArray->clone();
if (!array)
{
return pContext->ThrowNativeError("Failed to clone array. Out of memory.");
}
Handle_t hndl = handlesys->CreateHandle(htCellArray, array, pContext->GetIdentity(), g_pCoreIdent, NULL);
if (!hndl)