[libFuzzer] fix the stack-depth initialization, add a lit test for DeepRecursionTest.cpp

llvm-svn: 311421
This commit is contained in:
Kostya Serebryany 2017-08-22 01:50:00 +00:00
parent f65cf64fa2
commit 33fb36c353
2 changed files with 7 additions and 1 deletions

View File

@ -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 {

View File

@ -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