You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Double free in create_wall_timer if an invalid period is passed #1177
In create_wall_timer() in create_timer.hpp, if a bad period duration is passed (either < 0 or > nanoseconds::max()) then rcl will throw an error. During the destructor of WallTimer, it will call cancel, which results in a double free. I haven't found exactly where.
This issue is to track the several PRs I think will be necessary to resolve the cascade of errors present.
[20.871s] 8: [ RUN ] TestCreateTimer.call_wall_timer_with_bad_arguments
[20.874s] 8: [ERROR] [1592350214.053122631] [rclcpp]: Couldn't initialize rcl timer handle: timer period must be non-negative, at /home/brawner/workspace/ros2_master/src/ros2/rcl/rcl/src/rcl/timer.c:139
[20.874s] 8:
[20.874s] 8: terminate called after throwing an instance of 'std::runtime_error'
[20.874s] 8: what(): Couldn't cancel timer: timer is invalid, at /home/brawner/workspace/ros2_master/src/ros2/rcl/rcl/src/rcl/timer.c:379
[20.938s] 8: -- run_test.py: return code -6
During the destructor of WallTimer, it will call cancel, which results in a double free.
i do not think of doube free case either, but exception in destructor.
checking argument is also better, but we could change like only issue cancel on initialized rcl_timer_t successfully, i think that would be less exception.
Agreed @fujitatomoya. This was the intended second PR to followup and resolve the issue. It throws an exception in the constructor if rcl_timer_init fails.
Activity
brawner commentedon Jun 16, 2020
Add PR to check arguments in
create_wall_timer: #1178brawner commentedon Jun 16, 2020
For reference, this is the error message:
fujitatomoya commentedon Jun 17, 2020
@brawner
i do not think of
doube freecase either, but exception in destructor.checking argument is also better, but we could change like
only issue cancel on initialized rcl_timer_t successfully, i think that would be less exception.brawner commentedon Jun 17, 2020
Agreed @fujitatomoya. This was the intended second PR to followup and resolve the issue. It throws an exception in the constructor if
rcl_timer_initfails.#1179
brawner commentedon Jun 29, 2020
I believe this has been adequately addressed by #1178 and #1179.