-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
SUCCESS\ | ||
address must be a multiple of its type's alignment | ||
FAILURE\ | ||
unsafe { *raw_ptr } == 10 | ||
SUCCESS\ | ||
pointer NULL | ||
SUCCESS\ | ||
pointer invalid | ||
SUCCESS\ | ||
deallocated dynamic object | ||
FAILURE\ | ||
dead object | ||
SUCCESS\ | ||
pointer outside object bounds | ||
SUCCESS\ | ||
invalid integer address |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
#[kani::proof] | ||
pub fn check_invalid_ptr() { | ||
let raw_ptr = { | ||
let var = 10; | ||
&var as *const _ | ||
}; | ||
// This should fail since it is de-referencing a dead object. | ||
assert_eq!(unsafe { *raw_ptr }, 10); | ||
} |