@@ -1171,6 +1171,22 @@ void GlobalData::parseGameDataDefinition( INI* ini )
11711171 // parse the ini weapon definition
11721172 ini->initFromINI ( TheWritableGlobalData, s_GlobalDataFieldParseTable );
11731173
1174+ // TheSuperHackers @fix Sanitize values that are used as loop bounds or allocation sizes.
1175+ TheWritableGlobalData->m_numGlobalLights = std::clamp (TheWritableGlobalData->m_numGlobalLights , 0 , MAX_GLOBAL_LIGHTS);
1176+ TheWritableGlobalData->m_maxVisibleTranslucentObjects = std::max (TheWritableGlobalData->m_maxVisibleTranslucentObjects , 0 );
1177+ TheWritableGlobalData->m_maxVisibleOccluderObjects = std::max (TheWritableGlobalData->m_maxVisibleOccluderObjects , 0 );
1178+ TheWritableGlobalData->m_maxVisibleOccludeeObjects = std::max (TheWritableGlobalData->m_maxVisibleOccludeeObjects , 0 );
1179+ TheWritableGlobalData->m_maxVisibleNonOccluderOrOccludeeObjects = std::max (TheWritableGlobalData->m_maxVisibleNonOccluderOrOccludeeObjects , 0 );
1180+ TheWritableGlobalData->m_maxLineBuildObjects = std::max (TheWritableGlobalData->m_maxLineBuildObjects , 0 );
1181+ TheWritableGlobalData->m_maxRoadSegments = std::max (TheWritableGlobalData->m_maxRoadSegments , 0 );
1182+ TheWritableGlobalData->m_maxRoadVertex = std::max (TheWritableGlobalData->m_maxRoadVertex , 0 );
1183+ TheWritableGlobalData->m_maxRoadIndex = std::max (TheWritableGlobalData->m_maxRoadIndex , 0 );
1184+ TheWritableGlobalData->m_maxRoadTypes = std::max (TheWritableGlobalData->m_maxRoadTypes , 0 );
1185+ TheWritableGlobalData->m_maxTankTrackEdges = std::max (TheWritableGlobalData->m_maxTankTrackEdges , 1 );
1186+ TheWritableGlobalData->m_networkFPSHistoryLength = std::max (TheWritableGlobalData->m_networkFPSHistoryLength , 1u );
1187+ TheWritableGlobalData->m_networkLatencyHistoryLength = std::max (TheWritableGlobalData->m_networkLatencyHistoryLength , 1u );
1188+ TheWritableGlobalData->m_networkCushionHistoryLength = std::max (TheWritableGlobalData->m_networkCushionHistoryLength , 1u );
1189+
11741190 TheWritableGlobalData->m_userDataDir .clear ();
11751191 TheWritableGlobalData->m_userDataDir = BuildUserDataPathFromIni ();
11761192 CreateDirectory (TheWritableGlobalData->m_userDataDir .str (), nullptr );
0 commit comments