Skip to content

Commit 7c1b1ac

Browse files
Maullerxezon
authored andcommitted
[ZH] Add range check in removeDrawableFromLookupTable and removeObjectFromLookupTable (#764)
1 parent 7620c18 commit 7c1b1ac

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,8 @@ void GameClient::removeDrawableFromLookupTable( Drawable *draw )
878878
{
879879

880880
// sanity
881-
if( draw == NULL )
881+
// TheSuperHackers @fix Mauller/Xezon 24/04/2025 Prevent out of range access to vector lookup table
882+
if( draw == NULL || static_cast<size_t>(draw->getID()) >= m_drawableVector.size() )
882883
return;
883884

884885
// remove from table

GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3882,7 +3882,8 @@ void GameLogic::removeObjectFromLookupTable( Object *obj )
38823882
{
38833883

38843884
// sanity
3885-
if( obj == NULL )
3885+
// TheSuperHackers @fix Mauller/Xezon 24/04/2025 Prevent out of range access to vector lookup table
3886+
if( obj == NULL || static_cast<size_t>(obj->getID()) >= m_objVector.size() )
38863887
return;
38873888

38883889
// remove from lookup table

0 commit comments

Comments
 (0)