ros/ros_comm

Uninitialized member in ros::AdvertiseOptions

peci1 opened this issue · 0 comments

peci1 commented

AdvertiseOptions()
: callback_queue(0)
, latch(false)
{
}

Field has_header is of trivial type and the no-arg constructor does not initialize it. This has hit me with a hard-to-debug issue when creating advertiseoptions myself not using the all-arg constructor. If you create AdvertiseOptions using the no-arg constructor, has_header gets a random value and the code path in Publication tries to increment the seq field even if the message does not have a header.

Would a PR adding the missing initializer be accepted in Melodic and Noetic? I think adding an initializer should not break ABI or API.