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

Coverity - invalidate iterator cause overflow #1748

Closed
danielwangksu opened this issue Jul 9, 2019 · 2 comments
Closed

Coverity - invalidate iterator cause overflow #1748

danielwangksu opened this issue Jul 9, 2019 · 2 comments

Comments

@danielwangksu
Copy link
Contributor

danielwangksu commented Jul 9, 2019

It seems to me ROS_ASSERT_MSG only works when ROS_ASSERT_ENABLED is defined.
This leads to a problem in the remove() function in clients/roscpp/src/libros/spinner.cpp.
When ROS_ASSERT_ENABLED is not defined, the iterator loop will run out
of the scope of the array, and cause overflow.

std::map<ros::CallbackQueue*, Entry>::iterator it = spinning_queues_.find(queue);
ROS_ASSERT_MSG(it != spinning_queues_.end(), "Call to SpinnerMonitor::remove() without matching call to add().");
if (it->second.tid != boost::thread::id() && it->second.tid != boost::this_thread::get_id())

@dirk-thomas
Copy link
Member

Please consider to provide a pull request for this.

@danielwangksu
Copy link
Contributor Author

I think this should be a false alarm.

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