rclcpp icon indicating copy to clipboard operation
rclcpp copied to clipboard

[fix] Init EventHandlerBase::wait_set_event_index_

Open aosmw opened this issue 2 years ago • 1 comments

This prevents a call to is_ready() using an uninitalised index to access wait_set->events that may occur before the event has been setup in add_to_wait_set().

aosmw avatar Nov 30 '23 08:11 aosmw

I ran into this while developing a rclcpp lifecycle node with a number of services, publishers and subscribers with ASAN enabled.
It triggers a segfault when I use ros2 lifecycle /mynode set configure

I have made the change for rolling, but will also backport it to humble where I am really using it.

In humble the change will be performed in QOSEventBase which is in rclcpp/src/rclcpp/qos_event.cpp

A more thorough validation could be done in the is_ready function to ensure that the pointer to wait_set != nullptr && wait_set_event_index_ < wait_set->size_of_events

aosmw avatar Nov 30 '23 08:11 aosmw