Skip to content

[24365] Fix UB in serialization methods (backport #313)#314

Merged
MiguelCompany merged 1 commit into
2.2.xfrom
mergify/bp/2.2.x/pr-313
May 19, 2026
Merged

[24365] Fix UB in serialization methods (backport #313)#314
MiguelCompany merged 1 commit into
2.2.xfrom
mergify/bp/2.2.x/pr-313

Conversation

@mergify
Copy link
Copy Markdown

@mergify mergify Bot commented May 19, 2026

Description

This PR fixes:

  • UB error CdrSizeCalculator.hpp:1068:87: member call on null pointer of type 'const struct array' caused by an access to data->data() when size is 0.
  • UB error Cdr.h:2976:77: runtime error: member call on null pointer of type 'const struct array' caused by an access to data->data() when size is 0.

Related PRs

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.
  • N/A: Changes are backport compatible: they do NOT break ABI nor change library core behavior.
  • N/A: Changes are API compatible.
  • N/A: New feature has been added to the versions.md file (if applicable).
  • N/A: 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 #313 done by [Mergify](https://mergify.com).

* Refs #24365: Fix UB in calculate_array_serialized_size

Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com>

* Refs #24365: Fix UB in serialize array

Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com>

* Refs #24365: Unrelated Uncrustify

Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com>

* Refs #24365: Revision

Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com>

* Refs #24365: Unrelated Uncrustify FastCdr.h

Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com>

---------

Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com>
(cherry picked from commit a9bd70c)
@MiguelCompany MiguelCompany added this to the v2.2.8 milestone May 19, 2026
@MiguelCompany MiguelCompany self-requested a review May 19, 2026 08:07
@mergify mergify Bot mentioned this pull request May 19, 2026
8 tasks
@MiguelCompany MiguelCompany merged commit fa3331f into 2.2.x May 19, 2026
13 checks passed
@MiguelCompany MiguelCompany deleted the mergify/bp/2.2.x/pr-313 branch May 19, 2026 08:17
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