Added a sanity check on handle index in EntityToBCompatRef (bug 5539, r=psychonic).
Added a sanity check on handle index in EntityToBCompatRef (
bug 5539, r=psychonic).
1.1 --- a/core/HalfLife2.cpp Sat Dec 01 13:39:34 2012 -0500
1.2 +++ b/core/HalfLife2.cpp Sat Dec 01 13:41:00 2012 -0500
1.3 @@ -975,6 +975,11 @@
1.4 IServerUnknown *pUnknown = (IServerUnknown *)pEntity;
1.5 CBaseHandle hndl = pUnknown->GetRefEHandle();
1.6
1.7 + if (hndl == INVALID_EHANDLE_INDEX)
1.8 + {
1.9 + return INVALID_EHANDLE_INDEX;
1.10 + }
1.11 +
1.12 if (hndl.GetEntryIndex() >= MAX_EDICTS)
1.13 {
1.14 return (hndl.ToInt() | (1<<31));