You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Register trait allows reading and writing any pointer in safe code which is unsound.
Example:
use ruduino::Register;structUnsound;implRegisterforUnsound{typeT = u8;constADDRESS:*mutSelf::T = core::ptr::null_mut();// default implementations of `write`, `read`, `set_musk_raw`, `toggle_raw`, // `is_mask_set_raw` and `is_clear_raw` dereference `Self::ADDRESS`// (other methods also depend on them)}fnmain(){println!("{}",Unsound::read());}
(for me in debug it produces Process finished with exit code 139 (interrupted by signal 11: SIGSEGV) and in the release mode it prints 0)
Possible solutions:
make Register trait unsafe
do not provide unsound default impls
The text was updated successfully, but these errors were encountered:
Register
trait allows reading and writing any pointer in safe code which is unsound.Example:
(for me in debug it produces
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
and in the release mode it prints0
)Possible solutions:
Register
traitunsafe
The text was updated successfully, but these errors were encountered: