diff options
author | Kostya Serebryany <kcc@google.com> | 2017-08-22 01:50:00 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2017-08-22 01:50:00 +0000 |
commit | 33fb36c3537d79ec9751e73a31445814d709b1e4 (patch) | |
tree | f5df136ca3ce95b9daa4a3987a62b6715bcff87c | |
parent | f65cf64fa2d3f7804020b83719ad47969006ff2b (diff) | |
download | bcm5719-llvm-33fb36c3537d79ec9751e73a31445814d709b1e4.tar.gz bcm5719-llvm-33fb36c3537d79ec9751e73a31445814d709b1e4.zip |
[libFuzzer] fix the stack-depth initialization, add a lit test for DeepRecursionTest.cpp
llvm-svn: 311421
-rw-r--r-- | compiler-rt/lib/fuzzer/FuzzerTracePC.cpp | 4 | ||||
-rw-r--r-- | compiler-rt/test/fuzzer/deep-recursion.test | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp b/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp index ebd33d3ec88..985649a803b 100644 --- a/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp +++ b/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp @@ -343,8 +343,10 @@ void TracePC::ClearInlineCounters() { } } +ATTRIBUTE_NO_SANITIZE_ALL void TracePC::RecordInitialStack() { - InitialStack = __sancov_lowest_stack; + int stack; + __sancov_lowest_stack = InitialStack = reinterpret_cast<uintptr_t>(&stack); } uintptr_t TracePC::GetMaxStackOffset() const { diff --git a/compiler-rt/test/fuzzer/deep-recursion.test b/compiler-rt/test/fuzzer/deep-recursion.test new file mode 100644 index 00000000000..23b7af1df38 --- /dev/null +++ b/compiler-rt/test/fuzzer/deep-recursion.test @@ -0,0 +1,4 @@ +# Test that we can find a stack overflow +RUN: %cpp_compiler -fsanitize-coverage=stack-depth %S/DeepRecursionTest.cpp -o %t +RUN: not %t -seed=1 -runs=100000000 2>&1 | FileCheck %s +CHECK: ERROR: libFuzzer: deadly signal |