Added a sanity check on handle index in EntityToBCompatRef (bug 5539, r=psychonic).
This commit is contained in:
parent
b7ac61cbea
commit
52aa0a5b27
@ -975,6 +975,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