Commit e69a5b6
Fix UBSAN warnings in any_subscription_callback. (#1551)
When running the rclcpp tests under UBSAN, it complained that
the AnySubscriptionCallback tests were using an uninitialized
allocator.
Reviewing the code there, it also looks like the AnySubscriptionCallback
constructor wasn't checking for a null allocator.
Fix this by doing 3 things:
1. Add a check for a null allocator in the AnySubscriptionCallback
constructor.
2. Add a new test to test_any_subscription_callback that tests the new
nullptr handling.
3. Fix the test fixture to initialize the allocator before trying to
call the AnySubscriptionCallback constructor.
Signed-off-by: Chris Lalancette <[email protected]>1 parent 3f3d0f9 commit e69a5b6
File tree
2 files changed
+19
-1
lines changed- rclcpp
- include/rclcpp
- test/rclcpp
2 files changed
+19
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
68 | 71 | | |
69 | 72 | | |
70 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
48 | 63 | | |
49 | 64 | | |
50 | 65 | | |
| |||
0 commit comments