Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default constructed rosbag::ChunkedFile segfault on swap #2362

Open
Hugal31 opened this issue Nov 29, 2023 · 0 comments · May be fixed by #2363
Open

Default constructed rosbag::ChunkedFile segfault on swap #2362

Hugal31 opened this issue Nov 29, 2023 · 0 comments · May be fixed by #2363

Comments

@Hugal31
Copy link

Hugal31 commented Nov 29, 2023

rosbag::ChunkedFile::swap segfault if the ChunkedFile is default-constructed, because it tries to write to read_stream_->file_ while read_stream_ is null.

This causes rosbag::Bag to segfault as well when using std::swap, for instance when adding rosbags to a growing vector.

This code triggers the segfault:

#include <rosbag/bag.h>

int main()
{
  rosbag::Bag bag1;
  rosbag::Bag bag2;
  std::swap(bag1, bag2);
}
Hugal31 added a commit to Hugal31/ros_comm that referenced this issue Nov 29, 2023
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 a pull request may close this issue.

1 participant