Skip to content

Fix correctness defects in the std::pmr allocator conversion patches - #19

Open
pete-tempo wants to merge 1 commit into
mainfrom
fix/pmr-conversion-defects
Open

Fix correctness defects in the std::pmr allocator conversion patches#19
pete-tempo wants to merge 1 commit into
mainfrom
fix/pmr-conversion-defects

Conversation

@pete-tempo

Copy link
Copy Markdown
Contributor

Four fixes surfaced by an audit of the allocator/RTTI patches:

  1. rclcpp.patch (context.hpp): make Context::sub_contexts_ keyed by std::string unconditionally instead of std::type_index under RTTI / std::string under _LIBCPP_HAS_NO_RTTI. The library is built with RTTI while Unreal consumers define _LIBCPP_HAS_NO_RTTI, so the RTTI-dependent member type gave the same class two different layouts (sizeof/offsets) across the boundary -- an ODR/ABI mismatch. get_sub_context now derives a string key in both branches (class_name under no-RTTI, typeid(...).name() otherwise), so the only RTTI dependence is key derivation, never layout.

  2. rmw_cyclonedds.patch (TypeSupport2.hpp): ROSIDLCPP_U16StringValueType::type was left as std::u16string while its sibling string type was converted to std::pmr::string. sizeof_type() drives array/sequence striding in Serialization.cpp, so wstring arrays/sequences were strided by sizeof(std::u16string) over std::pmr::u16string data -- wrong offsets. Now std::pmr::u16string.

  3. Fast-CDR.patch (Cdr.h): the bounded char-string-array deserializeArray overload was declared template<class T, class Traits, class Allocator> with T and Traits absent from the signature, making it non-deducible and uninstantiable. Reduced to template to match its siblings.

  4. image_common.patch (publisher.cpp): removed leftover std::cout debug output (and its include) that was shipping in image_transport.

Each patch was regenerated from source and verified to apply cleanly to a pristine submodule checkout.

Four fixes surfaced by an audit of the allocator/RTTI patches:

1. rclcpp.patch (context.hpp): make Context::sub_contexts_ keyed by std::string
   unconditionally instead of std::type_index under RTTI / std::string under
   _LIBCPP_HAS_NO_RTTI. The library is built with RTTI while Unreal consumers
   define _LIBCPP_HAS_NO_RTTI, so the RTTI-dependent member type gave the same
   class two different layouts (sizeof/offsets) across the boundary -- an
   ODR/ABI mismatch. get_sub_context now derives a string key in both branches
   (class_name under no-RTTI, typeid(...).name() otherwise), so the only RTTI
   dependence is key derivation, never layout.

2. rmw_cyclonedds.patch (TypeSupport2.hpp): ROSIDLCPP_U16StringValueType::type
   was left as std::u16string while its sibling string type was converted to
   std::pmr::string. sizeof_type() drives array/sequence striding in
   Serialization.cpp, so wstring arrays/sequences were strided by
   sizeof(std::u16string) over std::pmr::u16string data -- wrong offsets.
   Now std::pmr::u16string.

3. Fast-CDR.patch (Cdr.h): the bounded char-string-array deserializeArray
   overload was declared template<class T, class Traits, class Allocator> with
   T and Traits absent from the signature, making it non-deducible and
   uninstantiable. Reduced to template<class Allocator> to match its siblings.

4. image_common.patch (publisher.cpp): removed leftover std::cout debug output
   (and its <iostream> include) that was shipping in image_transport.

Each patch was regenerated from source and verified to apply cleanly to a
pristine submodule checkout.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant