Skip to content

Commit af35ed9

Browse files
authored
[GEN][ZH] Prevent reading invalid data in LoadScreen (#1090)
1 parent 915bd64 commit af35ed9

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,7 @@ void MultiPlayerLoadScreen::processProgress(Int playerId, Int percentage)
886886
if( percentage < 0 || percentage > 100 || playerId >= MAX_SLOTS || playerId < 0 || m_playerLookup[playerId] == -1)
887887
{
888888
DEBUG_ASSERTCRASH(FALSE, ("Percentage %d was passed in for Player %d\n", percentage, playerId));
889+
return;
889890
}
890891
//DEBUG_LOG(("Percentage %d was passed in for Player %d (in loadscreen position %d)\n", percentage, playerId, m_playerLookup[playerId]));
891892
if(m_progressBars[m_playerLookup[playerId]])
@@ -1213,6 +1214,7 @@ void GameSpyLoadScreen::processProgress(Int playerId, Int percentage)
12131214
if( percentage < 0 || percentage > 100 || playerId >= MAX_SLOTS || playerId < 0 || m_playerLookup[playerId] == -1)
12141215
{
12151216
DEBUG_ASSERTCRASH(FALSE, ("Percentage %d was passed in for Player %d\n", percentage, playerId));
1217+
return;
12161218
}
12171219
//DEBUG_LOG(("Percentage %d was passed in for Player %d (in loadscreen position %d)\n", percentage, playerId, m_playerLookup[playerId]));
12181220
if(m_progressBars[m_playerLookup[playerId]])
@@ -1365,6 +1367,7 @@ void MapTransferLoadScreen::processProgress(Int playerId, Int percentage, AsciiS
13651367
if( percentage < 0 || percentage > 100 || playerId >= MAX_SLOTS || playerId < 0 || m_playerLookup[playerId] == -1)
13661368
{
13671369
DEBUG_ASSERTCRASH(FALSE, ("Percentage %d was passed in for Player %d\n", percentage, playerId));
1370+
return;
13681371
}
13691372

13701373
if (m_oldProgress[playerId] == percentage)

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,6 +1476,7 @@ void MultiPlayerLoadScreen::processProgress(Int playerId, Int percentage)
14761476
if( percentage < 0 || percentage > 100 || playerId >= MAX_SLOTS || playerId < 0 || m_playerLookup[playerId] == -1)
14771477
{
14781478
DEBUG_ASSERTCRASH(FALSE, ("Percentage %d was passed in for Player %d\n", percentage, playerId));
1479+
return;
14791480
}
14801481
//DEBUG_LOG(("Percentage %d was passed in for Player %d (in loadscreen position %d)\n", percentage, playerId, m_playerLookup[playerId]));
14811482
if(m_progressBars[m_playerLookup[playerId]])
@@ -1843,6 +1844,7 @@ void GameSpyLoadScreen::processProgress(Int playerId, Int percentage)
18431844
if( percentage < 0 || percentage > 100 || playerId >= MAX_SLOTS || playerId < 0 || m_playerLookup[playerId] == -1)
18441845
{
18451846
DEBUG_ASSERTCRASH(FALSE, ("Percentage %d was passed in for Player %d\n", percentage, playerId));
1847+
return;
18461848
}
18471849
//DEBUG_LOG(("Percentage %d was passed in for Player %d (in loadscreen position %d)\n", percentage, playerId, m_playerLookup[playerId]));
18481850
if(m_progressBars[m_playerLookup[playerId]])
@@ -1995,6 +1997,7 @@ void MapTransferLoadScreen::processProgress(Int playerId, Int percentage, AsciiS
19951997
if( percentage < 0 || percentage > 100 || playerId >= MAX_SLOTS || playerId < 0 || m_playerLookup[playerId] == -1)
19961998
{
19971999
DEBUG_ASSERTCRASH(FALSE, ("Percentage %d was passed in for Player %d\n", percentage, playerId));
2000+
return;
19982001
}
19992002

20002003
if (m_oldProgress[playerId] == percentage)

0 commit comments

Comments
 (0)