-
Notifications
You must be signed in to change notification settings - Fork 418
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
UBSAN: runtime error publisher_options.hpp:67:62: runtime error: reference binding to null pointer of type 'std::__1::shared_ptr<std::__1::allocator<void> >::element_type' (aka 'std::__1::allocator<void>') #849
Comments
Please consider continuing your investigation to determine which of the two cases it actually is. If it is the first a pull request would be highly appreciates. If it is the second case the ticket can be closed (if there is no way to suppress this warning programmatically). |
I'm leaning toward this might be an issue worth fixing. If you look at the context of the failing line: struct PublisherOptionsWithAllocator : public PublisherOptionsBase It appears to be de-ref'ing a null pointer, thought I'm not familiar enough with the surrounding code to suggest a useful fix at this point. Thinking. |
tried removing the .get(), but this doesn't remove the UBSAN warning... maybe I need to recompile ROS and then recompile cartographer/nav? |
To make reproducing this easier, could you please provide instructions for reproducing this on a minimal example? E.g. without cartographer, which would make it a lot less overhead. Thanks! |
I think this is worth fixing, and in general we shouldn't be using
(from: https://en.cppreference.com/w/cpp/named_req/Allocator#Requirements) Among other requirements. Also we should just emulate the interfaces uses by std containers like vector:
Taking it by https://en.cppreference.com/w/cpp/container/vector/get_allocator I'm working on a pr right now to change this across the entire code base. |
This bug still exists – @wjwwood is the linked PR addressing this? |
@nnmm No, unfortunately I got hung up trying to figure out how to do it in a deprecation cycle and never got around to it. |
Running the rclcpp tests, I don't see any instances of this particular UBSAN problem anymore. Thus I'm going to close this PR out. If this is still a problem, please feel free to reopen and we can look at it again. |
This just clears out some warnings from clang static analysis. Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
…os2#849) Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
Bug report
Required Info:
Steps to reproduce issue
Enable UBSAN by adding below lines to various CMakeLists.txt incl. cartographer & navigation2 modules
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=undefined")
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=undefined")
Rebuild all TB3 and related NAV packages with
colcon build --cmake-args -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Debug -DFORCE_DEBUG_BUILD=True --symlink-install
Run cartographer and navigation and map server logic as per the usual, notice a bunch of runtime errors (UBSAN warnings) that follow same pattern
Showing a sample from cartographer, but same exact pattern happens in occupancy grid, world model, dwb_controller, navfn_planner, etc. It's either worth fixing or just white noise, I'm not sure so I figured it's worth filing
[cartographer_node-1] ~/ros2_osx_dashing/install/rclcpp/include/rclcpp/publisher_options.hpp:67:62: runtime error: reference binding to null pointer of type 'std::__1::shared_ptr<std::__1::allocator >::element_type' (aka 'std::__1::allocator')
[cartographer_node-1] xcode_path/usr/include/c++/v1/memory:4706:63: runtime error: reference binding to null pointer of type 'std::__1::allocator'
[cartographer_node-1] xcode_path/usr/include/c++/v1/type_traits:2299:12: runtime error: reference binding to null pointer of type 'std::__1::allocator'
[cartographer_node-1] xcode_path/usr/include/c++/v1/memory:4706:41: runtime error: reference binding to null pointer of type 'std::__1::allocator'
[cartographer_node-1] xcode_path/usr/include/c++/v1/memory:4327:64: runtime error: reference binding to null pointer of type 'std::__1::allocator'
[cartographer_node-1] xcode_path/usr/include/c++/v1/memory:4327:42: runtime error: reference binding to null pointer of type 'std::__1::allocator'
[cartographer_node-1] xcode_path/usr/include/c++/v1/memory:3669:66: runtime error: reference binding to null pointer of type 'std::__1::allocator'
[cartographer_node-1] xcode_path/usr/include/c++/v1/memory:3669:44: runtime error: reference binding to null pointer of type 'std::__1::allocator'
[cartographer_node-1] xcode_path/usr/include/c++/v1/tuple:1111:48: runtime error: reference binding to null pointer of type 'std::__1::allocator'
[cartographer_node-1] xcode_path/usr/include/c++/v1/tuple:1111:28: runtime error: reference binding to null pointer of type 'std::__1::allocator'
[cartographer_node-1] xcode_path/usr/include/c++/v1/tuple:646:17: runtime error: reference binding to null pointer of type 'std::__1::allocator'
[cartographer_node-1] xcode_path/usr/include/c++/v1/tuple:380:56: runtime error: reference binding to null pointer of type 'std::__1::allocator'
[cartographer_node-1] xcode_path/usr/include/c++/v1/tuple:380:36: runtime error: reference binding to null pointer of type 'std::__1::allocator'
[cartographer_node-1] xcode_path/usr/include/c++/v1/tuple:221:44: runtime error: reference binding to null pointer of type 'std::__1::allocator'
[cartographer_node-1] xcode_path/usr/include/c++/v1/tuple:221:24: runtime error: reference binding to null pointer of type 'std::__1::allocator'
[cartographer_node-1] xcode_path/usr/include/c++/v1/tuple:265:102: runtime error: reference binding to null pointer of type 'std::__1::allocator'
[cartographer_node-1] xcode_path/usr/include/c++/v1/tuple:956:63: runtime error: reference binding to null pointer of type 'std::__1::allocator'
[cartographer_node-1] xcode_path/usr/include/c++/v1/memory:2190:44: runtime error: reference binding to null pointer of type 'std::__1::allocator'
[cartographer_node-1] xcode_path/usr/include/c++/v1/memory:2190:22: runtime error: reference binding to null pointer of type 'const std::__1::allocator'
Expected behavior
No warnings from UBSAN
Actual behavior
Saw warnings from UBSAN
Additional information
The text was updated successfully, but these errors were encountered: