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: even empty slices must be aligned properly #1112

Merged
merged 1 commit into from
Oct 22, 2024

Conversation

danking
Copy link
Member

@danking danking commented Oct 22, 2024

bytes::Bytes::slice does not preserve alignment whtn the range is empty. Instead, it returns a pointer to a statically allocated byte slice. In debug builds, this slice is located at address 0x1 which is not aligned for most types. Our assertion is insufficient for empty slices.

bytes::Bytes::slice does not preserve alignment whtn the range
is empty. Instead, it returns a pointer to a statically allocated
byte slice. In debug builds, this slice is located at address 0x1
which is not aligned for most types. Our assertion is insufficient
for empty slices.
@danking danking marked this pull request as ready for review October 22, 2024 17:03
@danking danking enabled auto-merge (squash) October 22, 2024 17:04
@danking danking merged commit f9180e0 into develop Oct 22, 2024
4 checks passed
@danking danking deleted the dk/align-the-empty-bytes branch October 22, 2024 17:12
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.

3 participants