Added a sanity check on handle index in EntityToBCompatRef (bug 5539, r=psychonic).
This commit is contained in:
parent
2f388cfdb4
commit
8355efaca4
@ -993,6 +993,11 @@ cell_t CHalfLife2::EntityToBCompatRef(CBaseEntity *pEntity)
|
||||
IServerUnknown *pUnknown = (IServerUnknown *)pEntity;
|
||||
CBaseHandle hndl = pUnknown->GetRefEHandle();
|
||||
|
||||
if (hndl == INVALID_EHANDLE_INDEX)
|
||||
{
|
||||
return INVALID_EHANDLE_INDEX;
|
||||
}
|
||||
|
||||
if (hndl.GetEntryIndex() >= MAX_EDICTS)
|
||||
{
|
||||
return (hndl.ToInt() | (1<<31));
|
||||
|
Loading…
Reference in New Issue
Block a user