1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-04 13:42:55 +01:00

Fix out of bounds access

This commit is contained in:
ζeh Matt
2021-09-28 01:24:51 +03:00
parent 04f15b7d45
commit 274bc039af

View File

@@ -55,7 +55,7 @@ constexpr size_t GetSpatialIndexOffset(int32_t x, int32_t y)
const auto tileY = std::clamp<size_t>(y / COORDS_XY_STEP, 0, MAXIMUM_MAP_SIZE_TECHNICAL);
const auto index = tileX * MAXIMUM_MAP_SIZE_TECHNICAL + tileY;
if (index >= sizeof(gSpriteSpatialIndex))
if (index >= std::size(gSpriteSpatialIndex))
{
return SPATIAL_INDEX_LOCATION_NULL;
}