| Index: tests_lit/asan_tests/errorlocaloffbynegative.ll
|
| diff --git a/tests_lit/asan_tests/errorlocaloffbynegative.ll b/tests_lit/asan_tests/errorlocaloffbynegative.ll
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..43bde71aaa6b23588d654b725aa4e7294a9cba35
|
| --- /dev/null
|
| +++ b/tests_lit/asan_tests/errorlocaloffbynegative.ll
|
| @@ -0,0 +1,31 @@
|
| +; Make sure off-by-negative OOB accesses of locals are caught
|
| +
|
| +; REQUIRES: no_minimal_build
|
| +
|
| +; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \
|
| +; RUN: --fsanitize-address --sz="-allow-externally-defined-symbols" \
|
| +; RUN: %t.pexe -o %t && not --crash %t 2>&1 | FileCheck \
|
| +; RUN: --check-prefix=CHECK32 %s
|
| +
|
| +declare external void @exit(i32)
|
| +
|
| +; A global array
|
| +@arr = internal constant [12 x i8] zeroinitializer
|
| +
|
| +define i32 @access() {
|
| + %arr = alloca i8, i32 12, align 1
|
| + %arraddr = ptrtoint i8* %arr to i32
|
| + %badaddr = add i32 -4, %arraddr
|
| + %badptr = inttoptr i32 %badaddr to i32*
|
| + %result = load i32, i32* %badptr, align 1
|
| + ret i32 %result
|
| +}
|
| +
|
| +define void @_start(i32 %__0) {
|
| + %result = call i32 @access()
|
| + call void @exit(i32 0)
|
| + unreachable
|
| +}
|
| +
|
| +; CHECK32: Illegal access of 4 bytes at
|
| +
|
|
|