From 1f78ad5da447ba111296038619245511c7ced5ed Mon Sep 17 00:00:00 2001 From: Alexander Potapenko Date: Mon, 11 Mar 2013 13:36:39 +0000 Subject: [PATCH] [ASan] Reduce the local buffer size in Report() not to fail the check enforced when building TSan runtime. llvm-svn: 176804 --- compiler-rt/lib/sanitizer_common/sanitizer_printf.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc b/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc index 8fb2778..2b00caed 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc @@ -201,8 +201,11 @@ int internal_snprintf(char *buffer, uptr length, const char *format, ...) { // Like Printf, but prints the current PID before the output string. void Report(const char *format, ...) { const int kLen = 16 * 1024; - // |local_buffer| is small enough not to overflow the stack. - char local_buffer[512]; + // |local_buffer| is small enough not to overflow the stack and/or violate + // the stack limit enforced by TSan (-Wframe-larger-than=512). On the other + // hand, the bigger the buffer is, the more the chance the error report will + // fit into it. + char local_buffer[400]; int needed_length; int pid = GetPid(); char *buffer = local_buffer; -- 2.7.4