-
-
Notifications
You must be signed in to change notification settings - Fork 312
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
1 changed file
with
29 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,29 @@ | ||
/* | ||
The purpose of this code is to demonstrate the capabilities | ||
of the monster model generator of selfie. Monster translates | ||
the code to an SMT-LIB or BTOR2 formula that is satisfiable | ||
if and only if the code exits with a non-zero exit code, or | ||
performs division by zero or invalid/unsafe memory accesses. | ||
Input == #b00110001 (== 49 == '1') | ||
*/ | ||
|
||
uint64_t main() { | ||
uint64_t a; | ||
uint64_t* x; | ||
|
||
x = malloc(8); | ||
|
||
read(1, x, 1); | ||
|
||
if (*x == 48) | ||
// address outside of virtual address space -> invalid memory access | ||
*(x + 4294967296) = 0; | ||
|
||
a = *x - 7; | ||
|
||
if (a == 42) | ||
return 1; | ||
else | ||
return 0; | ||
} |