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

fix(SpiralIterator): Avoid improper use of '++', which may cause prog… #479

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

luanlongshengv
Copy link

This PR addresses an issue in the SpiralIterator::operator++() function where the pop_back() method was called on an empty pointsRing_ container, leading to undefined behavior. The fix involves adding a check to ensure that pointsRing_ is not empty before attempting to call pop_back(). This change prevents potential crashes and ensures the iterator operates correctly even when the container is empty.
This change ensures the iterator’s robustness and prevents potential runtime errors.

@Ryanf55 Ryanf55 added the ros1 Affects ROS 1 label Nov 8, 2024
Copy link
Collaborator

@Ryanf55 Ryanf55 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ryanf55 Ryanf55 added the bug label Nov 8, 2024
@Ryanf55
Copy link
Collaborator

Ryanf55 commented Nov 8, 2024

@maximilianwulf Please merge this fix

@Ryanf55
Copy link
Collaborator

Ryanf55 commented Nov 28, 2024

This has been merged into all of the maintained ROS 2 branches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ros1 Affects ROS 1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants