Files
clang-p2996/compiler-rt/test/asan/TestCases/deep_stack_uaf.cc
Renato Golin 2b9d742ae7 [ARM|ASAN] Disabling more unstable ASAN tests
We're seeying these errors with GCC and Clang on different systems, while
some other identical OSs on different boards fail. Like many other ASAN
tests, there seem to be no easy way to investigate this other than someone
familiar with the sanitizer code and the ARM libraries.

At least, for now, we'll silence the bots. I'll create a bugzilla entry.

llvm-svn: 287464
2016-11-19 21:19:19 +00:00

36 lines
969 B
C++

// Check that we can store lots of stack frames if asked to.
// RUN: %clangxx_asan -O0 %s -o %t 2>&1
// RUN: %env_asan_opts=malloc_context_size=120:redzone=512 not %run %t 2>&1 | FileCheck %s
// REQUIRES: stable-runtime
#include <stdlib.h>
#include <stdio.h>
template <int depth>
struct DeepFree {
static void free(char *x) {
DeepFree<depth - 1>::free(x);
}
};
template<>
struct DeepFree<0> {
static void free(char *x) {
::free(x);
}
};
int main() {
char *x = (char*)malloc(10);
// deep_free(x);
DeepFree<200>::free(x);
return x[5];
// CHECK: {{.*ERROR: AddressSanitizer: heap-use-after-free on address}}
// The libcxxrt demangling procedure on FreeBSD 9.2 incorrectly appends
// extra 'E' characters to the end of template arguments; see:
// https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192115
// CHECK: {{DeepFree<36>|DeepFree<36E>}}
// CHECK: {{DeepFree<98>|DeepFree<98E>}}
// CHECK: {{DeepFree<115>|DeepFree<115E>}}
}