Files
0ad/source
Fabio Pedretti 4dfdfc12b2 Fix: Prevent out-of-bounds memory access in CheckBuildingPlacement
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.
2026-09-01 10:54:32 +02:00
..
2026-08-28 09:50:01 +02:00
2026-08-24 13:34:37 +02:00
2026-08-28 09:50:01 +02:00
2026-08-06 18:03:05 +02:00
2026-08-23 17:46:52 +02:00
2026-07-29 01:29:11 +02:00
2026-08-23 17:46:52 +02:00