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
OS Version: Ubuntu 24.04
rviz version: ros2 jazzy
Compiler name and version number: Ubuntu clang version 18.1.3
Source or binary build?
source build
build options: --mixin asan-gcc
Description
During unit testing of the WrenchVisual::WrenchVisual constructor, it was found that when a nullptr is passed as an argument, the program encounters a Segmentation Fault. The issue occurs because the program fails to validate the validity of the passed argument and attempts to access a null pointer, resulting in illegal memory access.
Running main() from gmock_main.cc
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from WrenchVisualTestFixture
[ RUN ] WrenchVisualTestFixture.constructor_handles_null_pointers_gracefully
[rviz_rendering:debug] Available Renderers(1): OpenGL Rendering Subsystem, at /home/shangzh/ros2_jazzy/src/ros2/rviz/rviz_rendering/src/rviz_rendering/render_system.cpp:289
[rviz_rendering:info] Stereo is NOT SUPPORTED, at /home/shangzh/ros2_jazzy/src/ros2/rviz/rviz_rendering/src/rviz_rendering/render_system.cpp:531
[rviz_rendering:info] OpenGl version: 4.3 (GLSL 4.3), at /home/shangzh/ros2_jazzy/src/ros2/rviz/rviz_rendering/src/rviz_rendering/render_system.cpp:272
AddressSanitizer:DEADLYSIGNAL=================================================================
==222634==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7cc7bd9c29b5 bp 0x7fff0d966eb0 sp 0x7fff0d966db0 T0)
==222634==The signal is caused by a READ memory access.
==222634==Hint: address points to the zero page.
#0 0x7cc7bd9c29b5 in rviz_rendering::WrenchVisual::WrenchVisual(Ogre::SceneManager*, Ogre::SceneNode*) (/home/shangzh/ros2_jazzy/install/rviz_rendering/lib/librviz_rendering.so+0x3c29b5) (BuildId: cffd3d255d72a7634225ec0bbe57959441c23146)
#1 0x626889fc0a68 in void std::_Construct<rviz_rendering::WrenchVisual, Ogre::SceneManager*&, Ogre::SceneNode*&>(rviz_rendering::WrenchVisual*, Ogre::SceneManager*&, Ogre::SceneNode*&) (/home/shangzh/ros2_jazzy/build/rviz_rendering/wrench_visual_test_target+0x2aa68) (BuildId: c19f8f7aaeceb19801278f9d1158d3a8f09a938b)
#2 0x626889fc0255 in std::_Sp_counted_ptr_inplace<rviz_rendering::WrenchVisual, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<Ogre::SceneManager*&, Ogre::SceneNode*&>(std::allocator<void>, Ogre::SceneManager*&, Ogre::SceneNode*&) (/home/shangzh/ros2_jazzy/build/rviz_rendering/wrench_visual_test_target+0x2a255) (BuildId: c19f8f7aaeceb19801278f9d1158d3a8f09a938b)
#3 0x626889fbfa6e in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<rviz_rendering::WrenchVisual, std::allocator<void>, Ogre::SceneManager*&, Ogre::SceneNode*&>(rviz_rendering::WrenchVisual*&, std::_Sp_alloc_shared_tag<std::allocator<void> >, Ogre::SceneManager*&, Ogre::SceneNode*&) (/home/shangzh/ros2_jazzy/build/rviz_rendering/wrench_visual_test_target+0x29a6e) (BuildId: c19f8f7aaeceb19801278f9d1158d3a8f09a938b)
#4 0x626889fbf242 in std::__shared_ptr<rviz_rendering::WrenchVisual, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<void>, Ogre::SceneManager*&, Ogre::SceneNode*&>(std::_Sp_alloc_shared_tag<std::allocator<void> >, Ogre::SceneManager*&, Ogre::SceneNode*&) (/home/shangzh/ros2_jazzy/build/rviz_rendering/wrench_visual_test_target+0x29242) (BuildId: c19f8f7aaeceb19801278f9d1158d3a8f09a938b)
#5 0x626889fbed41 in std::shared_ptr<rviz_rendering::WrenchVisual>::shared_ptr<std::allocator<void>, Ogre::SceneManager*&, Ogre::SceneNode*&>(std::_Sp_alloc_shared_tag<std::allocator<void> >, Ogre::SceneManager*&, Ogre::SceneNode*&) (/home/shangzh/ros2_jazzy/build/rviz_rendering/wrench_visual_test_target+0x28d41) (BuildId: c19f8f7aaeceb19801278f9d1158d3a8f09a938b)
#6 0x626889fbe0be in std::shared_ptr<std::enable_if<!std::is_array<rviz_rendering::WrenchVisual>::value, rviz_rendering::WrenchVisual>::type> std::make_shared<rviz_rendering::WrenchVisual, Ogre::SceneManager*&, Ogre::SceneNode*&>(Ogre::SceneManager*&, Ogre::SceneNode*&) (/home/shangzh/ros2_jazzy/build/rviz_rendering/wrench_visual_test_target+0x280be) (BuildId: c19f8f7aaeceb19801278f9d1158d3a8f09a938b)
#7 0x626889fbb978 in WrenchVisualTestFixture_constructor_handles_null_pointers_gracefully_Test::TestBody() (/home/shangzh/ros2_jazzy/build/rviz_rendering/wrench_visual_test_target+0x25978) (BuildId: c19f8f7aaeceb19801278f9d1158d3a8f09a938b)
#8 0x62688a05ea59 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/shangzh/ros2_jazzy/build/rviz_rendering/wrench_visual_test_target+0xc8a59) (BuildId: c19f8f7aaeceb19801278f9d1158d3a8f09a938b)
#9 0x62688a04bb65 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/shangzh/ros2_jazzy/build/rviz_rendering/wrench_visual_test_target+0xb5b65) (BuildId: c19f8f7aaeceb19801278f9d1158d3a8f09a938b)
#10 0x626889ff128b in testing::Test::Run() (/home/shangzh/ros2_jazzy/build/rviz_rendering/wrench_visual_test_target+0x5b28b) (BuildId: c19f8f7aaeceb19801278f9d1158d3a8f09a938b)
#11 0x626889ff2a67 in testing::TestInfo::Run() (/home/shangzh/ros2_jazzy/build/rviz_rendering/wrench_visual_test_target+0x5ca67) (BuildId: c19f8f7aaeceb19801278f9d1158d3a8f09a938b)
#12 0x626889ff3dc0 in testing::TestSuite::Run() (/home/shangzh/ros2_jazzy/build/rviz_rendering/wrench_visual_test_target+0x5ddc0) (BuildId: c19f8f7aaeceb19801278f9d1158d3a8f09a938b)
#13 0x62688a01aaeb in testing::internal::UnitTestImpl::RunAllTests() (/home/shangzh/ros2_jazzy/build/rviz_rendering/wrench_visual_test_target+0x84aeb) (BuildId: c19f8f7aaeceb19801278f9d1158d3a8f09a938b)
#14 0x62688a061eb4 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/shangzh/ros2_jazzy/build/rviz_rendering/wrench_visual_test_target+0xcbeb4) (BuildId: c19f8f7aaeceb19801278f9d1158d3a8f09a938b)
#15 0x62688a04ee02 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/shangzh/ros2_jazzy/build/rviz_rendering/wrench_visual_test_target+0xb8e02) (BuildId: c19f8f7aaeceb19801278f9d1158d3a8f09a938b)
#16 0x62688a0170f5 in testing::UnitTest::Run() (/home/shangzh/ros2_jazzy/build/rviz_rendering/wrench_visual_test_target+0x810f5) (BuildId: c19f8f7aaeceb19801278f9d1158d3a8f09a938b)
#17 0x626889fc1596 in RUN_ALL_TESTS() (/home/shangzh/ros2_jazzy/build/rviz_rendering/wrench_visual_test_target+0x2b596) (BuildId: c19f8f7aaeceb19801278f9d1158d3a8f09a938b)
#18 0x626889fc14e2 in main (/home/shangzh/ros2_jazzy/build/rviz_rendering/wrench_visual_test_target+0x2b4e2) (BuildId: c19f8f7aaeceb19801278f9d1158d3a8f09a938b)
#19 0x7cc7bb82a1c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
#20 0x7cc7bb82a28a in __libc_start_main_impl ../csu/libc-start.c:360
#21 0x626889fbb2b4 in _start (/home/shangzh/ros2_jazzy/build/rviz_rendering/wrench_visual_test_target+0x252b4) (BuildId: c19f8f7aaeceb19801278f9d1158d3a8f09a938b)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/home/shangzh/ros2_jazzy/install/rviz_rendering/lib/librviz_rendering.so+0x3c29b5) (BuildId: cffd3d255d72a7634225ec0bbe57959441c23146) in rviz_rendering::WrenchVisual::WrenchVisual(Ogre::SceneManager*, Ogre::SceneNode*)
==222634==ABORTING
Expected behavior
When the WrenchVisual::WrenchVisual constructor receives a nullptr as an argument, the following behavior is expected:
The function should check if the passed pointers are nullptr.
If any of the pointers are nullptr, an std::invalid_argument exception should be thrown, indicating that the input arguments are invalid.
The program should avoid encountering a segmentation fault when invalid parameters are passed.
Actual behavior
When a nullptr is passed as an argument, the WrenchVisual::WrenchVisual constructor does not properly validate the input, leading to direct access to the null pointer. This results in a Segmentation Fault and crashes the program.
Additional information
Suggested Fix
WrenchVisual::WrenchVisual(Ogre::SceneManager* scene_manager, Ogre::SceneNode* root_node) {
if (!scene_manager || !root_node) {
throwstd::invalid_argument("Scene manager or root node is null");
}
// Other constructor implementation
}
The text was updated successfully, but these errors were encountered:
Operating System:
Linux shangzh-VMware-Virtual-Platform 6.11.0-21-generic #21~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Feb 24 16:52:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
ROS version or commit hash:
ros2 jazzy
RMW implementation (if applicable):
No response
RMW Configuration (if applicable):
No response
Client library (if applicable):
rviz
'ros2 doctor --report' output
ros2 doc --report
Steps to reproduce issue
Environment
OS Version: Ubuntu 24.04
rviz version: ros2 jazzy
Compiler name and version number: Ubuntu clang version 18.1.3
Source or binary build?
source build
build options: --mixin asan-gcc
Description
During unit testing of the WrenchVisual::WrenchVisual constructor, it was found that when a nullptr is passed as an argument, the program encounters a Segmentation Fault. The issue occurs because the program fails to validate the validity of the passed argument and attempts to access a null pointer, resulting in illegal memory access.
Test Case
Output
Expected behavior
When the WrenchVisual::WrenchVisual constructor receives a nullptr as an argument, the following behavior is expected:
The function should check if the passed pointers are nullptr.
If any of the pointers are nullptr, an std::invalid_argument exception should be thrown, indicating that the input arguments are invalid.
The program should avoid encountering a segmentation fault when invalid parameters are passed.
Actual behavior
When a nullptr is passed as an argument, the WrenchVisual::WrenchVisual constructor does not properly validate the input, leading to direct access to the null pointer. This results in a Segmentation Fault and crashes the program.
Additional information
Suggested Fix
The text was updated successfully, but these errors were encountered: