Fix: illegal array access if resolution exceeds monitor resolution

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8822 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2020-06-17 22:22:26 +00:00
parent 3b3abc2bc6
commit 01d8bbf408
+6
View File
@@ -423,6 +423,12 @@ void RemoveCoverObjectsFromViewArea()
GetScreenXYWorldCell( gsVIEWPORT_END_X, gsVIEWPORT_START_Y, &usTmp, &gsMinCellY );
GetScreenXYWorldCell( gsVIEWPORT_START_X, gsVIEWPORT_END_Y, &usTmp, &gsMaxCellY );
// Flugente: hey, wouldn't it be cool if we DIDN'T access an array with implausible values?
gsMinCellX = max( 0, gsMinCellX );
gsMaxCellX = min( COVER_X_CELLS, gsMaxCellX );
gsMinCellY = max( 0, gsMinCellY );
gsMaxCellY = min( COVER_Y_CELLS, gsMaxCellY );
register INT32 ubX, ubY, ubZ;
BOOLEAN fChanged = FALSE;