mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
4dfdfc12b2
In `CCmpPathfinder::CheckBuildingPlacement`, the boundary check for the vertical grid dimension (`j > m_TerrainOnlyGrid->m_H`) allowed `j` to equal `m_TerrainOnlyGrid->m_H`. Since grid indices are 0-based (valid row indices range from `0` to `m_H - 1`), this boundary condition allowed the loop to execute with an out-of-bounds row index, leading to an invalid memory read (`m_TerrainOnlyGrid->get(i, j)`) and potential segfaults. This patch changes the comparison operator to `j >= m_TerrainOnlyGrid->m_H`, ensuring that spans extending to or past the grid height bound are properly flagged as out-of-bounds.