Fixes Table not checking for valid phantom nodes

We failed to check if we could actually find phantom nodes for all
coordinates in the table plugin, leading to corrupt internal state.

```
curl 'http://localhost:5000/table/v1/car/7.4151,43.7305;7.4222,43.7368?radiuses=0;'
```

```
[assert][140505627227904] /tmp/osrm-backend/include/engine/routing_algorithms/routing_base.hpp:68
in: void osrm::engine::routing_algorithms::insertNodesInHeap(osrm::engine::SearchEngineData<osrm::engine::routing_algorithms::ch::Algorithm>::ManyToManyQueryHeap&, const osrm::engine::PhantomNode&) [with bool DIRECTION = false; osrm::engine::SearchEngineData<osrm::engine::routing_algorithms::ch::Algorithm>::ManyToManyQueryHeap = osrm::util::BinaryHeap<unsigned int, unsigned int, int, osrm::engine::ManyToManyHeapData, osrm::util::UnorderedMapStorage<unsigned int, int> >]: phantom_node.IsValid()
terminate called without an active exception
```
This commit is contained in:
Daniel J. Hofmann
2017-05-02 11:08:26 +02:00
parent 5532ee627f
commit 9334cc463d
2 changed files with 34 additions and 1 deletions
+11 -1
View File
@@ -67,7 +67,17 @@ Status TablePlugin::HandleRequest(const datafacade::ContiguousInternalMemoryData
return Error("TooBig", "Too many table coordinates", result);
}
auto snapped_phantoms = SnapPhantomNodes(GetPhantomNodes(facade, params));
auto phantom_nodes = GetPhantomNodes(facade, params);
if (phantom_nodes.size() != params.coordinates.size())
{
return Error("NoSegment",
std::string("Could not find a matching segment for coordinate ") +
std::to_string(phantom_nodes.size()),
result);
}
auto snapped_phantoms = SnapPhantomNodes(phantom_nodes);
auto result_table =
algorithms.ManyToManySearch(snapped_phantoms, params.sources, params.destinations);