Skip to content

fix: segfault in Topic Re-Publisher on Jazzy (uninitialized callbacks_ in GenericPublisher)#113

Open
facontidavide wants to merge 3 commits intomainfrom
test_PR
Open

fix: segfault in Topic Re-Publisher on Jazzy (uninitialized callbacks_ in GenericPublisher)#113
facontidavide wants to merge 3 commits intomainfrom
test_PR

Conversation

@facontidavide
Copy link
Contributor

Summary

  • Fixes a segmentation fault in the ROS2 Topic Re-Publisher plugin when used with ROS2 Jazzy (ROS2 Topic Re-Publisher crashes with segfault in Jazzy due to JumpHandler initialization #112)
  • Root cause: callbacks_ (a member of GenericPublisher) was passed to the rclcpp::PublisherBase base class constructor before it was initialized — C++ undefined behavior
  • In Jazzy, rclcpp::PublisherBase calls rclcpp::JumpHandler::JumpHandler during construction while processing the callbacks, which dereferences the uninitialized object and causes a segfault
  • Fix: replace callbacks_ with a default-constructed temporary rclcpp::PublisherEventCallbacks{} and remove the now-unused member

Test plan

  • CI passes on ROS2 Jazzy build
  • CI passes on ROS2 Humble build (no regression)
  • CI passes on ROS2 Rolling build

Closes #112

🤖 Generated with Claude Code

facontidavide and others added 3 commits December 21, 2025 10:15
…cks_ member

The callbacks_ member was passed to the rclcpp::PublisherBase base class
constructor before it was initialized (C++ UB), causing a segfault inside
rclcpp::JumpHandler::JumpHandler on Jazzy. Replace with a default-constructed
temporary rclcpp::PublisherEventCallbacks{} and remove the now-unused member.

Fixes #112

Co-Authored-By: Claude Sonnet 4.6 <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.

ROS2 Topic Re-Publisher crashes with segfault in Jazzy due to JumpHandler initialization

1 participant