-
Notifications
You must be signed in to change notification settings - Fork 385
miri doesn't catch a violation of &mut [u8]
's validity invariants
#1762
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
I missed this bit from the README: "In particular, Miri does currently not check that integers/floats are initialized or that references point to valid data." |
For the int/float part, #1340 tracks adding an option to check that. But for references, I don't currently have plans to implement that -- it would be prohibitively expensive. Moreover I am anyway lobbying for relaxing that UB rule. ;) |
Makes sense. I'm assuming it would still be prohibitive to treat slices differently than "thin" references. I'd be interested to see a path for relaxing that rule, the ergonomics of single-write-only buffer usage is pretty rough. I have no idea what that'll look like, but you've got an eager audience :D. |
The discussion is at rust-lang/unsafe-code-guidelines#77. ;)
to
|
I think miri should fail on https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=a79f547a85d6d09e52756c2da3c121f4 because it produces an invalid
&mut [u8]
on line 11 (see context for reference interpretation).Should it be an error to produce a
&mut [u8]
that references uninit bytes?The text was updated successfully, but these errors were encountered: