mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
MapReader: Reject maps with out-of-range terrain tile texture index
m_Tex1Index is unvalidated (raw .pmp bytes / RMS script) and was used to index m_TerrainTextures with no bounds check.
This commit is contained in:
committed by
Ralph Sennhauser
parent
d37db2ba07
commit
e4e50d7711
@@ -358,6 +358,9 @@ int CMapReader::ApplyTerrainData()
|
||||
for (ssize_t k=0; k<PATCH_SIZE; k++) {
|
||||
CMiniPatch& mp = pTerrain->GetPatch(i,j)->m_MiniPatches[m][k]; // can't fail
|
||||
|
||||
if (tileptr->m_Tex1Index >= m_TerrainTextures.size())
|
||||
throw PSERROR_Game_World_MapLoadFailed("Error loading map: terrain tile references an invalid texture index.\nCheck application log for details.");
|
||||
|
||||
mp.Tex = m_TerrainTextures[tileptr->m_Tex1Index];
|
||||
mp.Priority = tileptr->m_Priority;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user