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: usage of BytesMut in extend_buf_sync #369

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

paolobarbolini
Copy link
Contributor

@paolobarbolini paolobarbolini commented Jan 25, 2025

While auditing usage of bytes I've found this crate incorrectly uses BytesMut.

The reserve branch would never get called, because BufMut::has_remaining_mut for BytesMut only checks self.len() < usize::MAX. The reason why the code worked anyways is that chunk_mut allocates if there's no spare capacity available.

This fixes the issue and makes the code simpler to read.

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.

1 participant