From eaeb8072cfeff0dc8ccddd17888463bba878fb6c Mon Sep 17 00:00:00 2001 From: "Michael X. Grey" Date: Mon, 9 Dec 2024 17:58:14 +0800 Subject: [PATCH 1/2] Fix buffer overflow for bounded sequence example Signed-off-by: Michael X. Grey --- examples/message_demo/src/message_demo.rs | 4 ++-- examples/rclrs_example_msgs/msg/VariousTypes.msg | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/message_demo/src/message_demo.rs b/examples/message_demo/src/message_demo.rs index 3e2bf53b2..de0237885 100644 --- a/examples/message_demo/src/message_demo.rs +++ b/examples/message_demo/src/message_demo.rs @@ -15,8 +15,8 @@ fn check_default_values() { assert_eq!(msg.float_seq_unbounded, seq![6.0]); assert_eq!(msg.string_member.to_string(), "Χαίρετε 你好"); assert_eq!(msg.wstring_member.to_string(), "αντίο σου 再见"); - assert_eq!(msg.bounded_string_member.to_string(), "äöü"); - assert_eq!(msg.bounded_wstring_member.to_string(), "äöü"); + assert_eq!(msg.bounded_string_member.to_string(), "aou"); + assert_eq!(msg.bounded_wstring_member.to_string(), "aou"); assert_eq!( msg.string_array.clone().map(|s| s.to_string()), ["R", "O", "S", "2"].map(String::from) diff --git a/examples/rclrs_example_msgs/msg/VariousTypes.msg b/examples/rclrs_example_msgs/msg/VariousTypes.msg index fc42d4110..3c42c8080 100644 --- a/examples/rclrs_example_msgs/msg/VariousTypes.msg +++ b/examples/rclrs_example_msgs/msg/VariousTypes.msg @@ -13,8 +13,8 @@ float32[] float_seq_unbounded [6.0] # String types string string_member "Χαίρετε 你好" wstring wstring_member "αντίο σου 再见" -string<=3 bounded_string_member "äöü" -wstring<=3 bounded_wstring_member "äöü" +string<=3 bounded_string_member "aou" +wstring<=3 bounded_wstring_member "aou" # Array/sequence of string type string[4] string_array ["R", "O", "S", "2"] From 927d32c8813ff2f9a8527b574ff9792b384ee645 Mon Sep 17 00:00:00 2001 From: "Michael X. Grey" Date: Mon, 9 Dec 2024 18:01:31 +0800 Subject: [PATCH 2/2] Allow longer characters for wstring Signed-off-by: Michael X. Grey --- examples/message_demo/src/message_demo.rs | 2 +- examples/rclrs_example_msgs/msg/VariousTypes.msg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/message_demo/src/message_demo.rs b/examples/message_demo/src/message_demo.rs index de0237885..d1fcea1d3 100644 --- a/examples/message_demo/src/message_demo.rs +++ b/examples/message_demo/src/message_demo.rs @@ -16,7 +16,7 @@ fn check_default_values() { assert_eq!(msg.string_member.to_string(), "Χαίρετε 你好"); assert_eq!(msg.wstring_member.to_string(), "αντίο σου 再见"); assert_eq!(msg.bounded_string_member.to_string(), "aou"); - assert_eq!(msg.bounded_wstring_member.to_string(), "aou"); + assert_eq!(msg.bounded_wstring_member.to_string(), "äöü"); assert_eq!( msg.string_array.clone().map(|s| s.to_string()), ["R", "O", "S", "2"].map(String::from) diff --git a/examples/rclrs_example_msgs/msg/VariousTypes.msg b/examples/rclrs_example_msgs/msg/VariousTypes.msg index 3c42c8080..ec990f0f2 100644 --- a/examples/rclrs_example_msgs/msg/VariousTypes.msg +++ b/examples/rclrs_example_msgs/msg/VariousTypes.msg @@ -14,7 +14,7 @@ float32[] float_seq_unbounded [6.0] string string_member "Χαίρετε 你好" wstring wstring_member "αντίο σου 再见" string<=3 bounded_string_member "aou" -wstring<=3 bounded_wstring_member "aou" +wstring<=3 bounded_wstring_member "äöü" # Array/sequence of string type string[4] string_array ["R", "O", "S", "2"]