Fixes use-after-move, closes #3820
This commit is contained in:
parent
3c81baa26e
commit
35c4c2a256
@ -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)
|
||||
{
|
||||
@ -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))
|
||||
|
@ -23,13 +23,11 @@ std::string getWrongOptionHelp(const engine::api::NearestParameters ¶meters)
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user