-
Notifications
You must be signed in to change notification settings - Fork 115
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
bits![static mut …] is unsound #156
Comments
I think possibles ways to close the soundness hole are:
|
*headdesk* my most common fault with testing this crate is that because I know what the pitfalls are, I instinctively avoid them and don't often come up with test cases that exercises pathological cases such as this because it doesn't occur to me to try this. The As far as I am able to determine, there is no sidestepping this problem: any method that allows producing a
|
Shifting the Regardless of whether the |
The
unsafe
-free code below creates two&mut
references to the same buffer at the same time, despite claim of the contrary in https://github.com/bitvecto-rs/bitvec/blob/main/book/data-structures/bitslice.md#macro-constructor. Multiple calls to a function accessing astatic
item will use the samestatic
value at the same address, even if the item is defined inside the function’s body.bits![mut …]
without astatic
token seems to be unaffected:If
bits![static mut 0; 64]
were to be changed to return&mut Bitslice
with a non-'static
lifetime but still backed by astatic
item, aliasing would still be possible in reentrant functions.The text was updated successfully, but these errors were encountered: