Fix segfault when route includes very short segments.
This commit is contained in:
parent
256d39b572
commit
6dedd9cb72
@ -1,3 +1,7 @@
|
|||||||
|
# 5.2.5
|
||||||
|
- Bugfixes
|
||||||
|
- Fixes a segfault caused by incorrect trimming logic for very short steps.
|
||||||
|
|
||||||
# 5.2.4
|
# 5.2.4
|
||||||
- Bugfixes:
|
- Bugfixes:
|
||||||
- Fixed in issue that arised on roundabouts in combination with intermediate intersections and sliproads
|
- Fixed in issue that arised on roundabouts in combination with intermediate intersections and sliproads
|
||||||
|
@ -10,7 +10,7 @@ endif()
|
|||||||
project(OSRM C CXX)
|
project(OSRM C CXX)
|
||||||
set(OSRM_VERSION_MAJOR 5)
|
set(OSRM_VERSION_MAJOR 5)
|
||||||
set(OSRM_VERSION_MINOR 2)
|
set(OSRM_VERSION_MINOR 2)
|
||||||
set(OSRM_VERSION_PATCH 4)
|
set(OSRM_VERSION_PATCH 5)
|
||||||
|
|
||||||
# these two functions build up custom variables:
|
# these two functions build up custom variables:
|
||||||
# OSRM_INCLUDE_PATHS and OSRM_DEFINES
|
# OSRM_INCLUDE_PATHS and OSRM_DEFINES
|
||||||
|
@ -17,7 +17,7 @@ module.exports = function () {
|
|||||||
this.setContractArgs(args, callback);
|
this.setContractArgs(args, callback);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.Given(/^a grid size of (\d+) meters$/, (meters, callback) => {
|
this.Given(/^a grid size of ([0-9.]+) meters$/, (meters, callback) => {
|
||||||
this.setGridSize(meters);
|
this.setGridSize(meters);
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
|
@ -24,3 +24,18 @@ Feature: Fixed bugs, kept to check for regressions
|
|||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| x | y | abc,abc |
|
| x | y | abc,abc |
|
||||||
|
|
||||||
|
Scenario: Step trimming with very short segments
|
||||||
|
Given a grid size of 0.1 meters
|
||||||
|
Given the node map
|
||||||
|
| a | 1 | b | c | d | 2 | e |
|
||||||
|
|
||||||
|
Given the ways
|
||||||
|
| nodes | oneway |
|
||||||
|
| ab | yes |
|
||||||
|
| bcd | yes |
|
||||||
|
| de | yes |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route |
|
||||||
|
| 1 | 2 | bcd,bcd |
|
||||||
|
@ -894,13 +894,13 @@ void trimShortSegments(std::vector<RouteStep> &steps, LegGeometry &geometry)
|
|||||||
auto &next_to_last_step = *(steps.end() - 2);
|
auto &next_to_last_step = *(steps.end() - 2);
|
||||||
// in the end, the situation with the roundabout cannot occur. As a result, we can remove
|
// in the end, the situation with the roundabout cannot occur. As a result, we can remove
|
||||||
// all zero-length instructions
|
// all zero-length instructions
|
||||||
if (next_to_last_step.distance <= 1)
|
if (next_to_last_step.distance <= 1 && steps.size() > 2)
|
||||||
{
|
{
|
||||||
geometry.locations.pop_back();
|
geometry.locations.pop_back();
|
||||||
geometry.annotations.pop_back();
|
geometry.annotations.pop_back();
|
||||||
geometry.osm_node_ids.pop_back();
|
geometry.osm_node_ids.pop_back();
|
||||||
geometry.segment_offsets.pop_back();
|
geometry.segment_offsets.pop_back();
|
||||||
BOOST_ASSERT(geometry.segment_distances.back() < 1);
|
BOOST_ASSERT(geometry.segment_distances.back() <= 1);
|
||||||
geometry.segment_distances.pop_back();
|
geometry.segment_distances.pop_back();
|
||||||
|
|
||||||
next_to_last_step.maneuver.waypoint_type = WaypointType::Arrive;
|
next_to_last_step.maneuver.waypoint_type = WaypointType::Arrive;
|
||||||
|
Loading…
Reference in New Issue
Block a user