-
Notifications
You must be signed in to change notification settings - Fork 23
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
The memchr implementation has UB #141
Comments
Good spot! It's unfortunate, because the memchr crate has some nice optimizations, but it appears we'll have to stop using it. |
Does the memchr crate speculatively read across pages? If not, ensuring that the memchr C function can't ever be inlined should be enough to prevent the compiler from exploiting UB even if it still technically exists. |
At a brief glance, I don't see any obvious unaligned loads in On the other hand, the public documentation of the I don't yet know who will want to use mustang or c-scape, or what they'll want to use it for. In the fullness of time, we could implement the optimizations that the memchr crate does in a way that respect the C That said, I am aware of an outstanding theoretical correctness bug in c-scape: #142. I submitted #143 which fixes the easy cases, and am thinking about having c-scape use a stack-allocated buffer in |
https://stackoverflow.com/questions/47315902/is-it-legal-to-call-memchr-with-a-too-long-length-if-you-know-the-character-wil
Basically a memchr call with too big a size is valid if you can guarantee that it will not be reached. Given mustang is not yet intended to be super performant, we can probably just replace this with a simple loop
Opening for storage after a discussion on the Rust community discord.
The text was updated successfully, but these errors were encountered: