Skip to content

Commit d3a6f17

Browse files
authored
[GEN][ZH] Prevent using uninitialized memory 'closestVec' in PartitionManager::getClosestObjects() (#1168)
1 parent 471a3cb commit d3a6f17

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3242,6 +3242,11 @@ Object *PartitionManager::getClosestObjects(
32423242
Object* closestObj = NULL;
32433243
Real closestDistSqr = maxDist * maxDist; // if it's not closer than this, we shouldn't consider it anyway...
32443244
Coord3D closestVec;
3245+
#if !RETAIL_COMPATIBLE_CRC // TheSuperHackers @info This should be safe to initialize because it is unused, but let us be extra safe for now.
3246+
closestVec.x = maxDist;
3247+
closestVec.y = maxDist;
3248+
closestVec.z = maxDist;
3249+
#endif
32453250

32463251
#ifdef FASTER_GCO
32473252

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3275,6 +3275,11 @@ Object *PartitionManager::getClosestObjects(
32753275
Object* closestObj = NULL;
32763276
Real closestDistSqr = maxDist * maxDist; // if it's not closer than this, we shouldn't consider it anyway...
32773277
Coord3D closestVec;
3278+
#if !RETAIL_COMPATIBLE_CRC // TheSuperHackers @info This should be safe to initialize because it is unused, but let us be extra safe for now.
3279+
closestVec.x = maxDist;
3280+
closestVec.y = maxDist;
3281+
closestVec.z = maxDist;
3282+
#endif
32783283

32793284
#ifdef FASTER_GCO
32803285

0 commit comments

Comments
 (0)