Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion rclcpp/test/rclcpp/test_intra_process_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ class PublisherBase
gid_.implementation_identifier = "mock_rmw";
auto ptr_value = reinterpret_cast<std::uintptr_t>(this);
for (size_t i = 0; i < RMW_GID_STORAGE_SIZE; ++i) {
gid_.data[i] = static_cast<uint8_t>((ptr_value >> (i * 8)) & 0xFF);
// The GID is wider than a pointer, so zero the bytes past the end of it. Shifting a
// std::uintptr_t by its width or more is undefined behavior.
gid_.data[i] = (i < sizeof(ptr_value)) ?
static_cast<uint8_t>((ptr_value >> (i * 8)) & 0xFF) : 0;
}
}

Expand Down
2 changes: 1 addition & 1 deletion rclcpp/test/rclcpp/test_utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ TEST(TestUtilities, remove_ros_arguments_rcl_parse_arguments_failed) {
};
int argc = sizeof(argv) / sizeof(const char *);

auto mock = mocking_utils::inject_on_return(
auto mock = mocking_utils::patch_and_return(
"lib:rclcpp", rcl_parse_arguments, RCL_RET_ERROR);
RCLCPP_EXPECT_THROW_EQ(
rclcpp::remove_ros_arguments(argc, argv),
Expand Down
Loading