Skip to content

Commit 7e5af55

Browse files
authored
Merge pull request #10 from robograph-project/emerson/jazzy-latest
Jazzy: merge latest upstream
2 parents 3574c0f + c2b19ed commit 7e5af55

File tree

5 files changed

+138
-2
lines changed

5 files changed

+138
-2
lines changed

rmw_implementation/CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
Changelog for package rmw_implementation
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44

5+
2.15.6 (2025-08-05)
6+
-------------------
7+
* Fixed windows warning (`#254 <https://github.com/ros2/rmw_implementation/issues/254>`_) (`#260 <https://github.com/ros2/rmw_implementation/issues/260>`_)
8+
(cherry picked from commit 8c006087e3af66a79f61dbe0ff45e7a1ef31a686)
9+
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
10+
* Contributors: mergify[bot]
11+
512
2.15.5 (2025-03-12)
613
-------------------
714
* Added rmw_event_type_is_supported (`#250 <https://github.com/ros2/rmw_implementation/issues/250>`_) (`#252 <https://github.com/ros2/rmw_implementation/issues/252>`_)

rmw_implementation/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="3">
44
<name>rmw_implementation</name>
5-
<version>2.15.5</version>
5+
<version>2.15.6</version>
66
<description>Proxy implementation of the ROS 2 Middleware Interface.</description>
77

88
<maintainer email="[email protected]">William Woodall</maintainer>

test_rmw_implementation/CHANGELOG.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22
Changelog for package test_rmw_implementation
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44

5+
2.15.6 (2025-08-05)
6+
-------------------
7+
* Test failing deserialization of invalid sequence length (`#261 <https://github.com/ros2/rmw_implementation/issues/261>`_) (`#263 <https://github.com/ros2/rmw_implementation/issues/263>`_)
8+
* Add test infrastructure.
9+
* Test that deserialization with wrong sequence length fails.
10+
---------
11+
(cherry picked from commit 4dd5d571a5bfa1a67183acf271dfa442932c7572)
12+
Co-authored-by: Miguel Company <[email protected]>
13+
* add ignore_local_publications_serialized test. (`#255 <https://github.com/ros2/rmw_implementation/issues/255>`_) (`#257 <https://github.com/ros2/rmw_implementation/issues/257>`_)
14+
(cherry picked from commit 1eceed45fbdbe6b93bb49993f1bed9698aeca38f)
15+
Co-authored-by: Tomoya Fujita <[email protected]>
16+
* Contributors: mergify[bot]
17+
518
2.15.5 (2025-03-12)
619
-------------------
720
* Added rmw_event_type_is_supported (`#250 <https://github.com/ros2/rmw_implementation/issues/250>`_) (`#252 <https://github.com/ros2/rmw_implementation/issues/252>`_)

test_rmw_implementation/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="3">
44
<name>test_rmw_implementation</name>
5-
<version>2.15.5</version>
5+
<version>2.15.6</version>
66
<description>Test suite for ROS middleware API.</description>
77

88
<maintainer email="[email protected]">William Woodall</maintainer>

test_rmw_implementation/test/test_serialize_deserialize.cpp

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
#include <gtest/gtest.h>
16+
#include <cstring>
1617

1718
#include "osrf_testing_tools_cpp/scope_exit.hpp"
1819

@@ -31,8 +32,87 @@
3132
#include "test_msgs/msg/bounded_plain_sequences.h"
3233
#include "test_msgs/msg/bounded_plain_sequences.hpp"
3334

35+
#include "test_msgs/msg/unbounded_sequences.h"
36+
#include "test_msgs/msg/unbounded_sequences.hpp"
37+
3438
#include "./allocator_testing_utils.h"
3539

40+
static void check_bad_cdr_sequence_cases(
41+
const rosidl_message_type_support_t * ts,
42+
void * message)
43+
{
44+
// Serialized CDR buffer for a data with all sequences empty.
45+
constexpr size_t kBufferSize = 132;
46+
const uint8_t valid_data[kBufferSize] = {
47+
0x01, 0x00, 0x00, 0x00, // representation header (CDR little endian)
48+
0x00, 0x00, 0x00, 0x00, // bool[] bool_values
49+
0x00, 0x00, 0x00, 0x00, // byte[] byte_values
50+
0x00, 0x00, 0x00, 0x00, // char[] char_values
51+
0x00, 0x00, 0x00, 0x00, // float32[] float32_values
52+
0x00, 0x00, 0x00, 0x00, // float64[] float64_values
53+
0x00, 0x00, 0x00, 0x00, // int8[] int8_values
54+
0x00, 0x00, 0x00, 0x00, // uint8[] uint8_values
55+
0x00, 0x00, 0x00, 0x00, // int16[] int16_values
56+
0x00, 0x00, 0x00, 0x00, // uint16[] uint16_values
57+
0x00, 0x00, 0x00, 0x00, // int32[] int32_values
58+
0x00, 0x00, 0x00, 0x00, // uint32[] uint32_values
59+
0x00, 0x00, 0x00, 0x00, // int64[] int64_values
60+
0x00, 0x00, 0x00, 0x00, // uint64[] uint64_values
61+
0x00, 0x00, 0x00, 0x00, // string[] string_values
62+
0x00, 0x00, 0x00, 0x00, // BasicTypes[] basic_types_values
63+
0x00, 0x00, 0x00, 0x00, // Constants[] constants_values
64+
0x00, 0x00, 0x00, 0x00, // Defaults[] defaults_values
65+
0x00, 0x00, 0x00, 0x00, // bool[] bool_values_default
66+
0x00, 0x00, 0x00, 0x00, // byte[] byte_values_default
67+
0x00, 0x00, 0x00, 0x00, // char[] char_values_default
68+
0x00, 0x00, 0x00, 0x00, // float32[] float32_values_default
69+
0x00, 0x00, 0x00, 0x00, // float64[] float64_values_default
70+
0x00, 0x00, 0x00, 0x00, // int8[] int8_values_default
71+
0x00, 0x00, 0x00, 0x00, // uint8[] uint8_values_default
72+
0x00, 0x00, 0x00, 0x00, // int16[] int16_values_default
73+
0x00, 0x00, 0x00, 0x00, // uint16[] uint16_values_default
74+
0x00, 0x00, 0x00, 0x00, // int32[] int32_values_default
75+
0x00, 0x00, 0x00, 0x00, // uint32[] uint32_values_default
76+
0x00, 0x00, 0x00, 0x00, // int64[] int64_values_default
77+
0x00, 0x00, 0x00, 0x00, // uint64[] uint64_values_default
78+
0x00, 0x00, 0x00, 0x00, // string[] string_values_default
79+
0x00, 0x00, 0x00, 0x00 // int32 alignment_check
80+
};
81+
82+
uint8_t buffer[kBufferSize];
83+
memcpy(buffer, valid_data, kBufferSize);
84+
85+
// The first 4 bytes are the CDR representation header, which we don't modify.
86+
constexpr size_t kFirstSequenceOffset = 4;
87+
// The last 4 bytes are the alignment check, which we also don't modify.
88+
constexpr size_t kLastSequenceOffset = kBufferSize - 4;
89+
// Each sequence length is stored as a 4-byte unsigned integer.
90+
constexpr size_t kSequenceLengthSize = 4;
91+
92+
for (size_t i = kFirstSequenceOffset; i < kLastSequenceOffset; i += kSequenceLengthSize) {
93+
// Corrupt the buffer by changing the size of a sequence to an invalid value.
94+
buffer[i] = 0xFF;
95+
buffer[i + 1] = 0xFF;
96+
buffer[i + 2] = 0xFF;
97+
buffer[i + 3] = 0xFF;
98+
99+
// Expect the deserialization to fail.
100+
rmw_serialized_message_t serialized_message = rmw_get_zero_initialized_serialized_message();
101+
serialized_message.buffer = const_cast<uint8_t *>(buffer);
102+
serialized_message.buffer_length = sizeof(buffer);
103+
serialized_message.buffer_capacity = sizeof(buffer);
104+
rmw_ret_t ret = rmw_deserialize(&serialized_message, ts, message);
105+
EXPECT_NE(RMW_RET_OK, ret);
106+
rmw_reset_error();
107+
108+
// Restore the buffer to a valid state.
109+
buffer[i] = 0x00;
110+
buffer[i + 1] = 0x00;
111+
buffer[i + 2] = 0x00;
112+
buffer[i + 3] = 0x00;
113+
}
114+
}
115+
36116
TEST(TestSerializeDeserialize, get_serialization_format) {
37117
const char * serialization_format = rmw_get_serialization_format();
38118
EXPECT_NE(nullptr, serialization_format);
@@ -171,6 +251,26 @@ TEST(TestSerializeDeserialize, clean_round_trip_for_c_bounded_message) {
171251
EXPECT_EQ(input_message.uint16_values.data[0], output_message.uint16_values.data[0]);
172252
}
173253

254+
TEST(TestSerializeDeserialize, bad_cdr_sequence_correctly_fails_for_c) {
255+
{
256+
const char * serialization_format = rmw_get_serialization_format();
257+
if (0 != strcmp(serialization_format, "cdr")) {
258+
GTEST_SKIP();
259+
}
260+
}
261+
262+
const rosidl_message_type_support_t * ts{
263+
ROSIDL_GET_MSG_TYPE_SUPPORT(test_msgs, msg, UnboundedSequences)};
264+
test_msgs__msg__UnboundedSequences output_message{};
265+
ASSERT_TRUE(test_msgs__msg__UnboundedSequences__init(&output_message));
266+
OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT(
267+
{
268+
test_msgs__msg__UnboundedSequences__fini(&output_message);
269+
});
270+
271+
check_bad_cdr_sequence_cases(ts, &output_message);
272+
}
273+
174274
TEST(TestSerializeDeserialize, clean_round_trip_for_cpp_message) {
175275
const rosidl_message_type_support_t * ts =
176276
rosidl_typesupport_cpp::get_message_type_support_handle<test_msgs::msg::BasicTypes>();
@@ -244,6 +344,22 @@ TEST(TestSerializeDeserialize, clean_round_trip_for_cpp_bounded_message) {
244344
EXPECT_EQ(input_message, output_message);
245345
}
246346

347+
TEST(TestSerializeDeserialize, bad_cdr_sequence_correctly_fails_for_cpp) {
348+
{
349+
const char * serialization_format = rmw_get_serialization_format();
350+
if (0 != strcmp(serialization_format, "cdr")) {
351+
GTEST_SKIP();
352+
}
353+
}
354+
355+
using TestMessage = test_msgs::msg::UnboundedSequences;
356+
const rosidl_message_type_support_t * ts =
357+
rosidl_typesupport_cpp::get_message_type_support_handle<TestMessage>();
358+
TestMessage output_message{};
359+
360+
check_bad_cdr_sequence_cases(ts, &output_message);
361+
}
362+
247363
TEST(TestSerializeDeserialize, rmw_get_serialized_message_size)
248364
{
249365
if (rmw_get_serialized_message_size(nullptr, nullptr, nullptr) != RMW_RET_UNSUPPORTED) {

0 commit comments

Comments
 (0)