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

Bug: default Read::read_to_end panic after seek #36

Closed
KKould opened this issue Sep 30, 2024 · 0 comments · Fixed by #35
Closed

Bug: default Read::read_to_end panic after seek #36

KKould opened this issue Sep 30, 2024 · 0 comments · Fixed by #35
Assignees
Labels
bug Something isn't working

Comments

@KKould
Copy link
Contributor

KKould commented Sep 30, 2024

before fix:

fn read_to_end(
        &mut self,
        mut buf: Vec<u8>,
    ) -> impl Future<Output = Result<Vec<u8>, Error>> + MaybeSend {
        async move {
            buf.resize(self.size().await? as usize, 0);
            let buf = self.read_exact(buf).await?;
            Ok(buf)
        }
    }

When Seek is not 0, resizing buf to the full size of the file results in eof

@KKould KKould added the bug Something isn't working label Sep 30, 2024
@KKould KKould self-assigned this Sep 30, 2024
@KKould KKould linked a pull request Sep 30, 2024 that will close this issue
@ethe ethe closed this as completed in #35 Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant