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

Tighten BytesMut guarantees #79

Closed
danburkert opened this issue Mar 19, 2017 · 0 comments
Closed

Tighten BytesMut guarantees #79

danburkert opened this issue Mar 19, 2017 · 0 comments

Comments

@danburkert
Copy link
Contributor

The docs for BufMut::bytes_mut specifically allow for the method to return an empty slice . This should be changed so that the method may only return a 0-length slice if the buffer is exhausted. Otherwise, it's extremely easy to trigger infinite loops (for instance, the current implementation of BufMut::put_slice). I believe the stdlib Write trait puts similar restrictions on 0-length writes for similar reasons.

Likewise, BufMut::bytes_vec_mut should not return a 0-length vector unless the buffer is exhausted, and probably shouldn't return 0-length IoVecs ever.

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

No branches or pull requests

1 participant