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
{{ message }}
Repository navigation
-Z valid-value-checks: writing an invalid bool through a *const round-trip or a transmuted &mut u8 is not reported #5021
T-High PriorityTag issues that have high priorityZ-Kani CompilerIssues that require some changes to the compiler[C] BugThis is a bug. Something isn't working.[F] SoundnessKani failed to detect an issue
Both fail. Reading b after storing 2 into it reads an invalid bool (Rust Reference,
[undefined.validity.bool]: "A bool value must be false (0) or true (1)").
Actual behavior
** 0 of 7 failed
VERIFICATION:- SUCCESSFUL
** 0 of 9 failed
VERIFICATION:- SUCCESSFUL
With a direct &mut b as *mut bool as *mut u8 cast, the same program fails:
Failed Checks: Kani currently doesn't support checking validity of `mutable cast` for `*mut bool`
Cause
visit_rvalue in kani-compiler/src/kani_middle/transform/check_values.rs:575-634 only inspects PtrToPtr casts whose destination is *mut U, and compares against the source pointee. The step *mut bool -> *const u8 is skipped (destination not *mut), and *const u8 -> *mut u8 has a
source pointee with no validity requirements. A transmute of &mut bool to &mut u8 is not
treated as a mutable cast at all; only the destination type of a transmute is checked.
Possibly related: #2998 (validity-checks tracking issue), #3762 (validity after copy/copy_nonoverlapping writes; different mechanism).
T-High PriorityTag issues that have high priorityZ-Kani CompilerIssues that require some changes to the compiler[C] BugThis is a bug. Something isn't working.[F] SoundnessKani failed to detect an issue
Activity
Valid-value checks: check reads of untyped bytes, not untyped writes (m…