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 use-after-free when a nodelet throws on initialization #122

Merged

Conversation

Hugal31
Copy link
Contributor

@Hugal31 Hugal31 commented Dec 4, 2023

When a nodelet thrown on initialization while using a CallbackQueue (e.g. by having a subscriber), the nodelet was deleted after the CallbackQueue, resulting in a use-after-free of the queue when deleting the nodelet.

This was because the NodeletPtr in Loader::load was deleted after the ManagedNodelet, which holds the CallbackQueues. Fix this by moving the NodeletPtr into the ManagedNodelet.

We also could call NodeletPtr::reset in the catch.

Closes #121.

When a nodelet thrown on initialization while using a CallbackQueue
(e.g. by having a subscriber), the nodelet was deleted before the
CallbackQueue, resulting in a use-after-free of the nodelet when
deleting the queue.
@mjcarroll mjcarroll merged commit b2a5e2e into ros:noetic-devel Jan 9, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

The loader crashes when initializing a nodelet with subscribers or publisher throws an exception
2 participants