Files
clang-p2996/compiler-rt/test/sanitizer_common/TestCases/symbolize_stack.cc
Vitaly Buka 89d054fc64 [compiler-rt] Fix incorrect use of snprintf
Summary:
snprintf returns buffer size needed for printing. If buffer was small, calling
code receives incorrectly symbolized buffer and fail.

Reviewers: eugenis

Subscribers: kubamracek, dberris, kcc

Differential Revision: https://reviews.llvm.org/D29440

llvm-svn: 293930
2017-02-02 20:10:07 +00:00

29 lines
743 B
C++

// RUN: %clangxx -O0 %s -o %t && %run %t 2>&1 | FileCheck %s
// Test that symbolizer does not crash on frame with large function name.
#include <sanitizer/common_interface_defs.h>
#include <vector>
template <int N> struct A {
template <class T> void RecursiveTemplateFunction(const T &t);
};
template <int N>
template <class T>
__attribute__((noinline)) void A<N>::RecursiveTemplateFunction(const T &) {
std::vector<T> t;
return A<N - 1>().RecursiveTemplateFunction(t);
}
template <>
template <class T>
__attribute__((noinline)) void A<0>::RecursiveTemplateFunction(const T &) {
__sanitizer_print_stack_trace();
}
int main() {
// CHECK: {{vector<.*vector<.*vector<.*vector<.*vector<}}
A<10>().RecursiveTemplateFunction(0);
}