Skip to content

Commit b9318ec

Browse files
authored
[GEN][ZH] Prevent reading invalid data from 'm_staticGameLODInfo' in GameLODManager::getRecommendedTextureReduction() (#1151)
1 parent 4c85403 commit b9318ec

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Generals/Code/GameEngine/Source/Common/GameLOD.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,9 @@ Int GameLODManager::getRecommendedTextureReduction(void)
693693
if (!m_memPassed) //if they have < 256 MB, force them to low res textures.
694694
return m_staticGameLODInfo[STATIC_GAME_LOD_LOW].m_textureReduction;
695695

696+
if (m_idealDetailLevel < 0 || m_idealDetailLevel >= STATIC_GAME_LOD_COUNT)
697+
return m_staticGameLODInfo[STATIC_GAME_LOD_LOW].m_textureReduction;
698+
696699
return m_staticGameLODInfo[m_idealDetailLevel].m_textureReduction;
697700
}
698701

GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,9 @@ Int GameLODManager::getRecommendedTextureReduction(void)
698698
if (!m_memPassed) //if they have < 256 MB, force them to low res textures.
699699
return m_staticGameLODInfo[STATIC_GAME_LOD_LOW].m_textureReduction;
700700

701+
if (m_idealDetailLevel < 0 || m_idealDetailLevel >= STATIC_GAME_LOD_COUNT)
702+
return m_staticGameLODInfo[STATIC_GAME_LOD_LOW].m_textureReduction;
703+
701704
return m_staticGameLODInfo[m_idealDetailLevel].m_textureReduction;
702705
}
703706

0 commit comments

Comments
 (0)