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

fix: Truncated fat entries on error #44

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ikrivosheev
Copy link
Contributor

Closed: #41

@mdsteele
Copy link
Owner

Looks like this needs some test updates.

@ikrivosheev
Copy link
Contributor Author

@ideeockus thank you for the help!
@mdsteele could you review?)

@@ -299,12 +320,14 @@ fn read_data_from_stream<F: Read + Seek>(
if stream_len < consts::MINI_STREAM_CUTOFF as u64 {
let mut chain = minialloc.open_mini_chain(start_sector)?;
chain.seek(SeekFrom::Start(buf_offset_from_start))?;
chain.read_exact(&mut buf[..num_bytes])?;
return Ok(read_until_error(&mut chain, &mut buf[..num_bytes])
Copy link
Owner

Choose a reason for hiding this comment

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

I'm a little confused what's going on with this change. Seems like it's changing to ignore IO errors? Why is that desired?

Copy link

@ideeockus ideeockus Sep 2, 2024

Choose a reason for hiding this comment

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

@mdsteele fat entries may be incomplete. read_exact emits Error { kind: UnexpectedEof, message: "failed to fill whole buffer" } in case of incomplete data

@mdsteele
Copy link
Owner

mdsteele commented Sep 6, 2024

Thanks, and sorry for the slow replies on my part. Could we add a unit test for this? It would be good to have. Also, I guess I'm concerned that this might not be the best way to solve the problem (I'm worried it will cover up other kinds of errors that it shouldn't), but having something to test against will make it easier to try out alternative solutions in the future.

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.

Malformed FAT entries mismatch
3 participants