-
Notifications
You must be signed in to change notification settings - Fork 461
Description
Bug report
Required Info:
- Operating System:
- Ubuntu 22.04
- Installation type:
- binaries
- Version or commit hash:
- the latest
- DDS implementation:
- defaulted
- Client library (if applicable):
- rclcpp
Steps to reproduce issue
the subscriber's destructor does not wait until currently processing callbacks are exited, which may cause troubles like UAF, null-pointer bugs.
Details are shown in navigation2 stack: ros-navigation/navigation2#4166
Expected behavior
We believe that the destructor of subscriber should have mechanisms to ensure complete release of relevant resources and fully exit ongoing works.
Actual behavior
there's no such mechanism.
Additional information
If there is no wait mechanism implemented in the subscriber's destructor to ensure that currently processing callbacks are exited beforehand, it could introduce the possibility of the freed pointer being accessed by ongoing tasks within the subscriber.
Consequently, this scenario may lead to instances of Use-After-Free (UAF) and null-pointer bugs. One illustrative example can be found within the navigation2 stack, as documented in the following issue: ros-navigation/navigation2#4166