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

alloc_str is probably unsound #6

Open
s3bk opened this issue Jun 1, 2021 · 1 comment
Open

alloc_str is probably unsound #6

s3bk opened this issue Jun 1, 2021 · 1 comment

Comments

@s3bk
Copy link
Contributor

s3bk commented Jun 1, 2021

It allocates with a different alignment than it drops.
It has to return a custom type that drops with the same layout as it allocates.

@Daniel-Liu-c0deb0t
Copy link
Owner

Yup, #4 is pretty much about the same thing. The fix would be to remove it, along with the hamming distance functions that rely on reading bytes as aligned integers. I believe that none of the main, re-exported functions actually use this (SIMD functions rely on unaligned reads), so it should be easily removable. An alternative is to use the ptr::read_unaligned function for safely reading unaligned bytes as integers.

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

2 participants