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

[Rust - bugfix] read_record_from_slice checking wrong size of buffer wrong #961

Conversation

dmweis
Copy link
Contributor

@dmweis dmweis commented Sep 1, 2023

Public-Facing Changes

There should be no changes in public API caused by this change.

Description

read_record_from_slice was checking that buffer size is bigger than 5 but was trying to read a u8 and u64 which are in total 9 bytes. This was causing panics when reading malformed mcap files or otherwise malformed streams.

I added some simple tests as well but they aren't very robust (I don't check parsing of records).

@dmweis dmweis changed the title [BugFix] read_record_from_slice checking wrong size of buffer wrong [Rust - bugfix] read_record_from_slice checking wrong size of buffer wrong Sep 1, 2023
Copy link
Member

@jtbandes jtbandes left a comment

Choose a reason for hiding this comment

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

Looks correct to me, adding @james-rms for a second sanity check.

@jtbandes jtbandes requested a review from james-rms October 4, 2023 01:47
@jtbandes jtbandes merged commit 7fa4dc1 into foxglove:main Oct 4, 2023
pezy pushed a commit to pezy/mcap that referenced this pull request Jan 11, 2024
…wrong (foxglove#961)

### Public-Facing Changes

There should be no changes in public API caused by this change.

### Description

`read_record_from_slice` was checking that buffer size is bigger than 5
but was trying to read a `u8` and `u64` which are in total 9 bytes. This
was causing panics when reading malformed mcap files or otherwise
malformed streams.

I added some simple tests as well but they aren't very robust (I don't
check parsing of records).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants