summaryrefslogtreecommitdiff
path: root/test/asan/TestCases/stack-overflow.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/asan/TestCases/stack-overflow.cc')
-rw-r--r--test/asan/TestCases/stack-overflow.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/asan/TestCases/stack-overflow.cc b/test/asan/TestCases/stack-overflow.cc
index 9d7c72c9c..7542d56b6 100644
--- a/test/asan/TestCases/stack-overflow.cc
+++ b/test/asan/TestCases/stack-overflow.cc
@@ -22,6 +22,7 @@
#include <unistd.h>
#include <sys/time.h>
#include <sys/resource.h>
+#include <sanitizer/asan_interface.h>
const int BS = 1024;
volatile char x;
@@ -65,7 +66,8 @@ void recursive_func(char *p) {
z13 = t13;
#else
char buf[BS];
- if (p)
+ // Check that the stack grows in the righ direction, unless we use fake stack.
+ if (p && !__asan_get_current_fake_stack())
assert(p - buf >= BS);
buf[rand() % BS] = 1;
buf[rand() % BS] = 2;