Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix EOF not being handled correctly #202

Merged
merged 2 commits into from
Jan 21, 2025
Merged

Fix EOF not being handled correctly #202

merged 2 commits into from
Jan 21, 2025

Conversation

sommd
Copy link
Contributor

@sommd sommd commented Jan 20, 2025

In IOReader and EIOReader, pop() does not properly handle EOF. The read() methods return Ok(0) when reaching the end of the file:

Switched to using read_exact(), which returns an Err if EOF is reached, which is what the code seems to expect.

Copy link

netlify bot commented Jan 20, 2025

Deploy Preview for cute-starship-2d9c9b canceled.

Name Link
🔨 Latest commit 57dcab0
🔍 Latest deploy log https://app.netlify.com/sites/cute-starship-2d9c9b/deploys/678f2139a382d30008a5bc39

@max-heller
Copy link
Collaborator

Makes sense, could you add a test covering this?

@sommd
Copy link
Contributor Author

sommd commented Jan 21, 2025

Wasn't sure where you'd want to put integration tests (didn't feel like they'd fit in loopback), so I just added some unit tests. If you want integration tests, just let me know where I should put them 🙂

Copy link
Collaborator

@max-heller max-heller left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for the contribution!

@max-heller max-heller merged commit 2b9940e into jamesmunns:main Jan 21, 2025
5 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants