-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1949 from GaloisInc/rem/iss-1932
iss-1932
- Loading branch information
Showing
6 changed files
with
34 additions
and
2 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,2 @@ | ||
bound.bc : bound.c | ||
clang -c -emit-llvm -frecord-command-line -o $@ $< |
Binary file not shown.
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,5 @@ | ||
#include <stdint.h> | ||
|
||
uint32_t f(uint32_t x[2]) { | ||
return x[1]; | ||
} |
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,15 @@ | ||
let f_spec = do { | ||
x <- llvm_alloc (llvm_array 2 (llvm_int 32)); | ||
a <- llvm_fresh_var "a" (llvm_int 32); | ||
llvm_points_to (llvm_elem x 1) (llvm_term a); | ||
|
||
// BAD: Out-of-bounds write | ||
llvm_points_to (llvm_elem x 2) (llvm_term a); | ||
|
||
llvm_execute_func [x]; | ||
|
||
llvm_return (llvm_term a); | ||
}; | ||
|
||
m <- llvm_load_module "bound.bc"; | ||
llvm_verify m "f" [] false f_spec z3; |
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,10 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
# We want to ensure there isn't a memory store failure and this is caught during type checking of Setup Value | ||
if $SAW bound.saw | grep -q "array type index out of bounds"; then | ||
exit 0 | ||
else | ||
exit 1 | ||
fi |
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