Skip to content

Don't deallocate with the wrong size in test_allocator_common - #3409

Draft
mjcarroll wants to merge 1 commit into
rollingfrom
mjcarroll/test-allocator-common-mismatch
Draft

mjcarroll wants to merge 1 commit into
rollingfrom
mjcarroll/test-allocator-common-mismatch

Conversation

@mjcarroll

@mjcarroll mjcarroll commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Description

Test fix: retyped_deallocate()/retyped_reallocate() free one element, but the tests allocated 20 chars or 2 ints, or allocated as char and freed as int (new-delete-type-mismatch under ASan). The tests now allocate one element of the freed type.

Is this user-facing behavior change?

No.

Did you use Generative AI?

Claude Code (Claude Opus 5.5) found this under ASan and wrote the change; I reviewed it.

Additional Information

retyped_deallocate() and retyped_reallocate() always deallocate a single
element, but the tests allocated 1 char, 20 chars or 2 ints and then
deallocated 1 int or 1 char. Sized deallocation with the wrong size is
undefined behavior; AddressSanitizer reports a new-delete-type-mismatch.
Only allocate one element of the type that is deallocated.

Signed-off-by: Michael Carroll <mjcarroll.oss@gmail.com>
@github-actions

Copy link
Copy Markdown

ABI Compliance Check

✅ Verdict: compatible

Library Verdict Summary
libcomponent_manager.so ✅ compatible No ABI changes detected.
librclcpp.so ✅ compatible No ABI changes detected.
librclcpp_action.so ✅ compatible No ABI changes detected.
librclcpp_lifecycle.so ✅ compatible No ABI changes detected.
✅ libcomponent_manager.so — full abidiff report

Compared:

  • Base: lib-base/libcomponent_manager.so
  • Head: lib-pr/libcomponent_manager.so @ b788790
(empty report — no differences printed by abidiff)
✅ librclcpp.so — full abidiff report

Compared:

  • Base: lib-base/librclcpp.so
  • Head: lib-pr/librclcpp.so @ b788790
Functions changes summary: 0 Removed (3 filtered out), 0 Changed (124 filtered out), 0 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable


✅ librclcpp_action.so — full abidiff report

Compared:

  • Base: lib-base/librclcpp_action.so
  • Head: lib-pr/librclcpp_action.so @ b788790
(empty report — no differences printed by abidiff)
✅ librclcpp_lifecycle.so — full abidiff report

Compared:

  • Base: lib-base/librclcpp_lifecycle.so
  • Head: lib-pr/librclcpp_lifecycle.so @ b788790
(empty report — no differences printed by abidiff)

Updated for commit b788790 · check run · suppressions: /home/runner/work/_temp/ros2-abi-suppressions.txt

@mjcarroll
mjcarroll marked this pull request as draft November 10, 2026 02:41
@mjcarroll mjcarroll added the sanitizers Found with or related to ASan/LSan/UBSan/TSan label Nov 10, 2026
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.

1 participant