Avoid using signed integers for edge IDs

This commit is contained in:
Michael Krasnyk 2018-04-12 09:02:06 +02:00
parent c1fd02bb8d
commit ba095c8566
No known key found for this signature in database
GPG Key ID: 49C12AD0F43D2108
4 changed files with 15 additions and 3 deletions

View File

@ -1,3 +1,8 @@
# 5.16.6
- Changes from 5.16.5:
- Bugfixes:
- FIXED: integer overflow in `DynamicGraph::Renumber` [#5021](https://github.com/Project-OSRM/osrm-backend/pull/5021)
# 5.16.5
- Changes from 5.16.4:
- Debug:

View File

@ -61,7 +61,7 @@ endif()
project(OSRM C CXX)
set(OSRM_VERSION_MAJOR 5)
set(OSRM_VERSION_MINOR 16)
set(OSRM_VERSION_PATCH 5)
set(OSRM_VERSION_PATCH 6)
set(OSRM_VERSION "${OSRM_VERSION_MAJOR}.${OSRM_VERSION_MINOR}.${OSRM_VERSION_PATCH}")
add_definitions(-DOSRM_PROJECT_DIR="${CMAKE_CURRENT_SOURCE_DIR}")

View File

@ -2,6 +2,8 @@
#define DYNAMICGRAPH_HPP
#include "util/deallocating_vector.hpp"
#include "util/exception.hpp"
#include "util/exception_utils.hpp"
#include "util/integer_range.hpp"
#include "util/permutation.hpp"
#include "util/typedefs.hpp"
@ -424,7 +426,7 @@ template <typename EdgeDataT> class DynamicGraph
util::inplacePermutation(node_array.begin(), node_array.end(), old_to_new_node);
// Build up edge permutation
auto new_edge_index = 0;
EdgeID new_edge_index = 0;
std::vector<EdgeID> old_to_new_edge(edge_list.size(), SPECIAL_EDGEID);
for (auto node : util::irange<NodeID>(0, number_of_nodes))
{
@ -432,6 +434,11 @@ template <typename EdgeDataT> class DynamicGraph
// move all filled edges
for (auto edge : GetAdjacentEdgeRange(node))
{
if (new_edge_index == std::numeric_limits<EdgeID>::max())
{
throw util::exception("There are too many edges, OSRM only supports 2^32" +
SOURCE_REF);
}
edge_list[edge].target = old_to_new_node[edge_list[edge].target];
BOOST_ASSERT(edge_list[edge].target != SPECIAL_NODEID);
old_to_new_edge[edge] = new_edge_index++;

View File

@ -1,6 +1,6 @@
{
"name": "osrm",
"version": "5.16.5",
"version": "5.16.6",
"private": false,
"description": "The Open Source Routing Machine is a high performance routing engine written in C++14 designed to run on OpenStreetMap data.",
"dependencies": {