Skip to content

[25753] Fix for XCDR2 map member header (backport #368) - #372

Merged
MiguelCompany merged 2 commits into
2.4.xfrom
mergify/bp/2.4.x/pr-368
Dec 2, 2026
Merged

MiguelCompany merged 2 commits into
2.4.xfrom
mergify/bp/2.4.x/pr-368

Conversation

@mergify

@mergify mergify Bot commented Dec 2, 2026

Copy link
Copy Markdown

Description

An std::map with string keys and primitive values failed to deserialize as a member of a mutable struct with XCDRv2. Maps with other key types, or in structs which are not mutable, worked.

Serializing a string sets serialized_member_size_, which tells the member header that the data starts with its own size. The map overload for primitive values never reset it, so the map length was announced as the member size in bytes. The flag is now reset after the map, in both Cdr and CdrSizeCalculator

@Mergifyio backport 2.4.x 2.3.x 2.2.x

Contributor Checklist

  • Commit messages follow the project guidelines.
  • The code follows the style guidelines of this project.
  • Tests that thoroughly check the new feature have been added/Regression tests checking the bug and its fix have been added; the added tests pass locally
  • N/A Any new/modified methods have been properly documented using Doxygen.
  • Changes are backport compatible: they do NOT break ABI nor change library core behavior.
  • Changes are API compatible.
  • N/A New feature has been added to the versions.md file (if applicable).
  • Applicable backports have been included in the description.

Reviewer Checklist

  • The PR has a milestone assigned.
  • The title and description correctly express the PR's purpose.
  • Check contributor checklist is correct.
  • Check CI results: changes do not issue any warning.
  • Check CI results: CI pass and failing tests are unrelated with the changes.

This is an automatic backport of pull request #368 done by [Mergify](https://mergify.com).

* Add regression test for maps with string keys in XCDRv2 mutable members

Signed-off-by: Zakaria Talbi Lalmi <zakariatalbi@eprosima.com>

* Stop joining map length with NEXTINT when keys are strings

Signed-off-by: Zakaria Talbi Lalmi <zakariatalbi@eprosima.com>

---------

Signed-off-by: Zakaria Talbi Lalmi <zakariatalbi@eprosima.com>
(cherry picked from commit 26399d6)
@mergify mergify Bot mentioned this pull request Dec 2, 2026
11 tasks done
@MiguelCompany MiguelCompany added this to the v2.4.1 milestone Dec 2, 2026
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
@MiguelCompany
MiguelCompany self-requested a review December 2, 2026 13:24
@MiguelCompany
MiguelCompany merged commit 1675e45 into 2.4.x Dec 2, 2026
12 checks passed
@MiguelCompany
MiguelCompany deleted the mergify/bp/2.4.x/pr-368 branch December 2, 2026 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants