Daniel-Liu-c0deb0t/triple_accel

alloc_str is probably unsound

s3bk opened this issue · 1 comments

s3bk commented

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.

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.