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:
The IdentityFrameTransformer::transform function does not perform validity checks on the target_frame parameter. When an invalid target_frame (e.g., an empty string) is passed in, the function does not throw the expected exception but instead proceeds and returns the original input pose_in. This behavior does not match the expected behavior in the unit test, leading to a test failure.
Running main() from gmock_main.cc
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from IdentityTransformerFixture
[ RUN ] IdentityTransformerFixture.transform_throws_exception_on_invalid_target_frame
/home/shangzh/ros2_jazzy/src/ros2/rviz/rviz_common/test/transformation/identity_frame_transformer_test.cpp:24: Failure
Expected: transformer_->transform(pose_stamped, "") throws an exception of type std::invalid_argument.
Actual: it throws nothing.
[ FAILED ] IdentityTransformerFixture.transform_throws_exception_on_invalid_target_frame (0 ms)
[----------] 1 test from IdentityTransformerFixture (0 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (0 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] IdentityTransformerFixture.transform_throws_exception_on_invalid_target_frame
1 FAILED TEST
Expected behavior
When the transform function receives an invalid target_frame (e.g., an empty string), it should throw a std::invalid_argument exception indicating that the input parameter is invalid, ensuring the function correctly handles invalid inputs.
Actual behavior
In the current implementation, the transform function does not check the validity of target_frame. When an empty string or other invalid values are passed in, the function does not throw any exceptions but instead directly returns the passed pose_in
Additional information
Suggested Fixes:
Add input validity check: Include an input validity check for the target_frame parameter in the transform function. If target_frame is an empty string or another invalid value, a std::invalid_argument exception should be thrown.
if (target_frame.empty()) {
throwstd::invalid_argument("Target frame cannot be empty");
}
The text was updated successfully, but these errors were encountered:
Operating System:
Linux shangzh-VMware-Virtual-Platform 6.11.0-19-generic #19~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Feb 17 11:51:52 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:
The IdentityFrameTransformer::transform function does not perform validity checks on the target_frame parameter. When an invalid target_frame (e.g., an empty string) is passed in, the function does not throw the expected exception but instead proceeds and returns the original input pose_in. This behavior does not match the expected behavior in the unit test, leading to a test failure.
Test Case
Output
Expected behavior
When the transform function receives an invalid target_frame (e.g., an empty string), it should throw a std::invalid_argument exception indicating that the input parameter is invalid, ensuring the function correctly handles invalid inputs.
Actual behavior
In the current implementation, the transform function does not check the validity of target_frame. When an empty string or other invalid values are passed in, the function does not throw any exceptions but instead directly returns the passed pose_in
Additional information
Suggested Fixes:
Add input validity check: Include an input validity check for the target_frame parameter in the transform function. If target_frame is an empty string or another invalid value, a std::invalid_argument exception should be thrown.
The text was updated successfully, but these errors were encountered: