Index: lib/sanitizer_common/sanitizer_common.h =================================================================== --- lib/sanitizer_common/sanitizer_common.h +++ lib/sanitizer_common/sanitizer_common.h @@ -171,6 +171,7 @@ void Printf(const char *format, ...); void Report(const char *format, ...); void SetPrintfAndReportCallback(void (*callback)(const char *)); +bool IsSetPrintfAndReportCallback(); #define VReport(level, ...) \ do { \ if ((uptr)Verbosity() >= (level)) Report(__VA_ARGS__); \ Index: lib/sanitizer_common/sanitizer_common_libcdep.cc =================================================================== --- lib/sanitizer_common/sanitizer_common_libcdep.cc +++ lib/sanitizer_common/sanitizer_common_libcdep.cc @@ -36,6 +36,9 @@ if (SANITIZER_WINDOWS) return false; + if (IsSetPrintfAndReportCallback()) + return false; + const char *flag = common_flags()->color; return internal_strcmp(flag, "always") == 0 || (internal_strcmp(flag, "auto") == 0 && report_file.SupportsColors()); Index: lib/sanitizer_common/sanitizer_printf.cc =================================================================== --- lib/sanitizer_common/sanitizer_printf.cc +++ lib/sanitizer_common/sanitizer_printf.cc @@ -207,6 +207,10 @@ PrintfAndReportCallback = callback; } +bool IsSetPrintfAndReportCallback() { + return (PrintfAndReportCallback!=NULL); +} + // Can be overriden in frontend. #if SANITIZER_SUPPORTS_WEAK_HOOKS SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE @@ -277,7 +281,8 @@ break; # undef CHECK_NEEDED_LENGTH } - RawWrite(buffer); + if (!PrintfAndReportCallback) + RawWrite(buffer); if (common_flags()->log_to_syslog && ShouldLogAfterPrintf()) WriteToSyslog(buffer); CallPrintfAndReportCallback(buffer);