[sanitizer] Do not fall back to SlowUnwindStack() in GetStackTrace()
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@183414 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/lsan/lsan_common_linux.cc b/lib/lsan/lsan_common_linux.cc
index 10a434b..9570810 100644
--- a/lib/lsan/lsan_common_linux.cc
+++ b/lib/lsan/lsan_common_linux.cc
@@ -96,8 +96,9 @@
uptr size = 0;
const uptr *trace = StackDepotGet(stack_id, &size);
// The top frame is our malloc/calloc/etc. The next frame is the caller.
- CHECK_GE(size, 2);
- return trace[1];
+ if (size >= 2)
+ return trace[1];
+ return 0;
}
void ProcessPlatformSpecificAllocationsCb::operator()(void *p) const {
diff --git a/lib/sanitizer_common/sanitizer_posix_libcdep.cc b/lib/sanitizer_common/sanitizer_posix_libcdep.cc
index 43da171..429f5de 100644
--- a/lib/sanitizer_common/sanitizer_posix_libcdep.cc
+++ b/lib/sanitizer_common/sanitizer_posix_libcdep.cc
@@ -99,7 +99,7 @@
// Always unwind fast on Mac.
(void)fast;
#else
- if (!fast || (stack_top == stack_bottom))
+ if (!fast)
return stack->SlowUnwindStack(pc, max_s);
#endif // SANITIZER_MAC
stack->size = 0;