Skip to content
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

Segfault from Linkage::Criteria::expandToTarget() #489

Closed
jslee02 opened this issue Aug 16, 2015 · 3 comments
Closed

Segfault from Linkage::Criteria::expandToTarget() #489

jslee02 opened this issue Aug 16, 2015 · 3 comments
Milestone

Comments

@jslee02
Copy link
Member

jslee02 commented Aug 16, 2015

Linkage.cpp Ln:364

  // If we have successfully reached the target, expand from there
  if(newBns.back() == _target.mNode.lock())
    expansionPolicy(_target.mNode.lock(), _target.mPolicy, newBns);

Segfault is raised at newBns.back() when newBns is empty. According to cppreference, calling back on an empty container is undefined. I observed that this segfault is happened on Windows but not Ubuntu or Mac.

@mxgrey
Copy link
Member

mxgrey commented Aug 16, 2015

This is actually a really easy fix. This is just an unhandled edge case where the linkage wasn't able to expand towards the target whatsoever. The current code incorrectly assumes that it was able to take at least one step towards the target. We just need to change the if-statement to if(newBns.size() > 0 && newBns.back() == _target.mNode.lock()). I'll make a pull request with the fix.

@jslee02
Copy link
Member Author

jslee02 commented Aug 16, 2015

Thanks! I confirmed that it fixes the segfault. I just made a comment on #490 about minor code preference.

@jslee02 jslee02 added this to the DART 5.1.0 milestone Aug 17, 2015
@jslee02
Copy link
Member Author

jslee02 commented Aug 17, 2015

Fixed by #490, #491, and #492.

@jslee02 jslee02 closed this as completed Aug 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants