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 UB in DoRead::read_from() #3

Merged
merged 1 commit into from
Dec 11, 2019

Conversation

sdroege
Copy link
Contributor

@sdroege sdroege commented Dec 10, 2019

We need to initialize the buffer first before creating a byte slice from
it and passing it to Read::read().


See also comment in the code. This kind of defeats the purpose of getting uninitialized data to begin with, and is probably a good argument for not having this kind of API in tokio::AsyncRead and bytes to begin with until there's API in std to handle this in a more useful way.

We need to initialize the buffer first before creating a byte slice from
it and passing it to Read::read().
@daniel-abramov
Copy link
Member

FYI @agalakhov

@daniel-abramov daniel-abramov merged commit 61d0d32 into snapview:master Dec 11, 2019
@sdroege
Copy link
Contributor Author

sdroege commented Dec 11, 2019

There is discussion for improving the API in tokio 0.3 etc, but I think as long as we have to deal with a Read there's nothing that can be improved here.

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