data_tamer
data_tamer copied to clipboard
undefined behavior in serialization
Casting buffer memory to a serialized data type in https://github.com/PickNikRobotics/data_tamer/blob/main/data_tamer_cpp/include/data_tamer/contrib/SerializeMe.hpp#L493 is undefined behavior due to alignment requirements, see https://en.cppreference.com/w/cpp/language/ub and https://stackoverflow.com/questions/55560713/ubsan-store-to-misaligned-address-what-is-the-problem-and-should-i-care, e.g., doubles must be 8 byte aligned.
The source variable should be memcpy()d to the destination instead.
PS: another reason to consider https://github.com/PickNikRobotics/data_tamer/issues/34