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

Fixed corrupted messages when reopening a rosbag with a different file (#1176) #1192

Merged
merged 2 commits into from
Oct 23, 2017

Conversation

racko
Copy link
Contributor

@racko racko commented Oct 17, 2017

  • Cleaned up more state in Bag::close() and ChunkedFile::close()
  • It was not investigated how exactly the bug worked

I kept #1188 as-is to demonstrate the failing test. (I think I remember that the CI only builds the latest commit in a pull-request, right?)

chunk_open_ = false;
curr_chunk_data_pos_ = 0;
current_buffer_ = 0;
decompressed_chunk_ = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be easier now that #1189 has been merged. Please update the patch to call the new init method instead.

* Bag::decompressed_chunk_ was not reset in close(). decompressed_chunk_
stores the offset (within the file) of the compressed chunk whose
decompressed content is currently stored in decompress_buffer_. Since it
wasn't reset in close(), if the offset is the same as that of the first
chunk in the file opened next, Bag::decompressChunk() assumed that
it had already decompressed that chunk in the new file and just returned.
As a result, some member functions of Bag worked on the decompressed
chunk of the old bag.
* Cleaned up more state in Bag::close() and ChunkedFile::close()
@racko
Copy link
Contributor Author

racko commented Oct 21, 2017

Done. I also analyzed the bug a bit more and found the following cause, which I added to the commit message:

* Bag::decompressed_chunk_ was not reset in close(). decompressed_chunk_
stores the offset (within the file) of the compressed chunk whose
decompressed content is currently stored in decompress_buffer_. Since it
wasn't reset in close(), if the offset is the same as that of the first
chunk in the file opened next, Bag::decompressChunk() assumed that
it had already decompressed that chunk in the new file and just returned.
As a result, some member functions of Bag worked on the decompressed
chunk of the old bag.

@dirk-thomas
Copy link
Member

Thank you for the patch.

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.

2 participants