From 56da87689eb8d4af0193e70c86af5d9abb051ec6 Mon Sep 17 00:00:00 2001 From: Michael Bell Date: Mon, 13 Sep 2021 19:56:38 +0100 Subject: [PATCH] Fix metric offset overflow for large MLD partitions Each MLD cell has source and destination nodes. MLD is keeping a |source| x |destination| sized table for various metrics (distances, durations, etc) from each source to all destinations in a cell. It stores all of the values for a metric in one large array, with an offset for each cell to find its values. The offset is currently limited to 32 bit values, which overflows on very large graphs (e.g. Planet OSM). We fix this by changing the offsets to be size types. --- CHANGELOG.md | 1 + include/partitioner/cell_storage.hpp | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bcf36c0af3..f12eac0a467 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - FIXED: Fixed Boost link flags in pkg-config file. [#6083](https://github.com/Project-OSRM/osrm-backend/pull/6083) - Routing: - FIXED: Fix generation of inefficient MLD partitions [#6084](https://github.com/Project-OSRM/osrm-backend/pull/6084) + - FIXED: Fix metric offset overflow for large MLD partitions [#6124](https://github.com/Project-OSRM/osrm-backend/pull/6124) # 5.25.0 - Changes from 5.24.0 diff --git a/include/partitioner/cell_storage.hpp b/include/partitioner/cell_storage.hpp index 42c347861d2..c2265c19954 100644 --- a/include/partitioner/cell_storage.hpp +++ b/include/partitioner/cell_storage.hpp @@ -52,11 +52,9 @@ namespace detail template class CellStorageImpl { public: - using ValueOffset = std::uint32_t; - using BoundaryOffset = std::uint32_t; + using ValueOffset = std::size_t; + using BoundaryOffset = std::size_t; using BoundarySize = std::uint32_t; - using SourceIndex = std::uint32_t; - using DestinationIndex = std::uint32_t; static constexpr auto INVALID_VALUE_OFFSET = std::numeric_limits::max(); static constexpr auto INVALID_BOUNDARY_OFFSET = std::numeric_limits::max();