-
Notifications
You must be signed in to change notification settings - Fork 661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix segfault: Do not combine last turn channel maneuver #2463
Conversation
@@ -2336,7 +2336,7 @@ bool ManeuversBuilder::IsTurnChannelManeuverCombinable(std::list<Maneuver>::iter | |||
bool start_man) const { | |||
|
|||
// Current maneuver must be a turn channel and not equal to the next maneuver | |||
if (curr_man->turn_channel() && (curr_man != next_man)) { | |||
if (curr_man->turn_channel() && (curr_man != next_man) && !next_man->IsDestinationType()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we leave a TODOD note that we need to extend this logic (of not combining with the destination maneuver) to other places as well?
Are there tests which exercise this code-path when roundabout_exits is true & false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually not sure where it makes sense to extend this logic, as it seems to have been deliberately left out of the other collapse cases. I'll follow up with @dgearhart about that as soon as I can.
Re: tests, I mentioned in the OP that I'll follow up with a gurka test. Meanwhile @gknisely helped run RAD tests with this change and saw no diffs, so I'm fairly confident the fix is localized to the situation that triggers the bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. RAD showing 0 diffs is a good sign! :) 👍
@gknisely thank you for adding the gurka test! I confirmed it fails on master due to missing the destination maneuver:
|
Issue
Fixes an invalid access bug triggered by combining maneuvers at a turn channel that is also a roundabout exit. The fix is to simply skip the turn channel collapsing logic if the next maneuver is the last maneuver in the route.
Although the turn channel collapsing logic is not new and the bug has been in valhalla for a while, the segfault actually occurs further along in new code that was added to collapse roundabout exit maneuvers. The combination of collapsing the final maneuver, then collapsing again for roundabout_exits=false, triggers the bug.
Address sanitizer output: asan.txt
We haven't been able to craft a reproducible test case in gurka yet as it's been tricky getting the tags just right for a link to be marked as a turn_channel. I'll follow up with a test case in a future PR.
Tasklist
Requirements / Relations
Link any requirements here. Other pull requests this PR is based on?