Skip to content

Commit

Permalink
Merge branch 'master' into merge-node-osrm
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-j-h authored Mar 16, 2017
2 parents 283845c + 35c4c2a commit fcf7520
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
8 changes: 8 additions & 0 deletions src/engine/routing_algorithms/shortest_path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,11 @@ shortestPathSearchImpl(SearchEngineData &engine_working_data,
new_total_weight_to_reverse = new_total_weight_to_forward;
packed_leg_to_reverse = std::move(packed_leg_to_forward);
new_total_weight_to_forward = INVALID_EDGE_WEIGHT;

// (*)
//
// Below we have to check if new_total_weight_to_forward is invalid.
// This prevents use-after-move on packed_leg_to_forward.
}
else if (target_phantom.reverse_segment_id.enabled)
{
Expand Down Expand Up @@ -341,6 +346,9 @@ shortestPathSearchImpl(SearchEngineData &engine_working_data,
}
}

// Note: To make sure we do not access the moved-from packed_leg_to_forward
// we guard its access by a check for invalid edge weight. See (*) above.

// No path found for both target nodes?
if ((INVALID_EDGE_WEIGHT == new_total_weight_to_forward) &&
(INVALID_EDGE_WEIGHT == new_total_weight_to_reverse))
Expand Down
12 changes: 5 additions & 7 deletions src/server/service/nearest_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@ std::string getWrongOptionHelp(const engine::api::NearestParameters &parameters)

const auto coord_size = parameters.coordinates.size();

const bool param_size_mismatch =
constrainParamSize(
PARAMETER_SIZE_MISMATCH_MSG, "hints", parameters.hints, coord_size, help) ||
constrainParamSize(
PARAMETER_SIZE_MISMATCH_MSG, "bearings", parameters.bearings, coord_size, help) ||
constrainParamSize(
PARAMETER_SIZE_MISMATCH_MSG, "radiuses", parameters.radiuses, coord_size, help);
constrainParamSize(PARAMETER_SIZE_MISMATCH_MSG, "hints", parameters.hints, coord_size, help);
constrainParamSize(
PARAMETER_SIZE_MISMATCH_MSG, "bearings", parameters.bearings, coord_size, help);
constrainParamSize(
PARAMETER_SIZE_MISMATCH_MSG, "radiuses", parameters.radiuses, coord_size, help);

return help;
}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/routed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ int main(int argc, const char *argv[]) try
else
{
util::Log(logWARNING) << "Didn't exit within 2 seconds. Hard abort!";
server_task.reset(); // just kill it
std::exit(EXIT_FAILURE);
}
}

Expand Down

0 comments on commit fcf7520

Please sign in to comment.