Skip to content

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