[compiler-rt] r208290 - [sanitizer] Unconditionally write to target buffer in *sprintf interceptors.
Evgeniy Stepanov
eugeni.stepanov at gmail.com
Thu May 8 02:18:22 PDT 2014
Author: eugenis
Date: Thu May 8 04:18:22 2014
New Revision: 208290
URL: http://llvm.org/viewvc/llvm-project?rev=208290&view=rev
Log:
[sanitizer] Unconditionally write to target buffer in *sprintf interceptors.
This does not change the default behavior (check_printf in on by default in all tools).
With this change, check_printf flag only affects format string parsing.
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc?rev=208290&r1=208289&r2=208290&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc Thu May 8 04:18:22 2014
@@ -750,7 +750,7 @@ FORMAT_INTERCEPTOR_IMPL(__isoc99_sscanf,
printf_common(ctx, format, aq); \
} \
int res = REAL(vname)(str, __VA_ARGS__); \
- if (res >= 0 && common_flags()->check_printf) { \
+ if (res >= 0) { \
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, str, res + 1); \
} \
VPRINTF_INTERCEPTOR_RETURN(); \
@@ -764,7 +764,7 @@ FORMAT_INTERCEPTOR_IMPL(__isoc99_sscanf,
printf_common(ctx, format, aq); \
} \
int res = REAL(vname)(str, size, __VA_ARGS__); \
- if (res >= 0 && common_flags()->check_printf) { \
+ if (res >= 0) { \
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, str, Min(size, (SIZE_T)(res + 1))); \
} \
VPRINTF_INTERCEPTOR_RETURN(); \
@@ -774,12 +774,12 @@ FORMAT_INTERCEPTOR_IMPL(__isoc99_sscanf,
#define VASPRINTF_INTERCEPTOR_IMPL(vname, strp, ...) \
{ \
VPRINTF_INTERCEPTOR_ENTER(vname, strp, __VA_ARGS__) \
+ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, strp, sizeof(char *)); \
if (common_flags()->check_printf) { \
- COMMON_INTERCEPTOR_WRITE_RANGE(ctx, strp, sizeof(char *)); \
printf_common(ctx, format, aq); \
} \
int res = REAL(vname)(strp, __VA_ARGS__); \
- if (res >= 0 && common_flags()->check_printf) { \
+ if (res >= 0) { \
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, *strp, res + 1); \
} \
VPRINTF_INTERCEPTOR_RETURN(); \
More information about the llvm-commits
mailing list