From 9e609426a784f3905df95a669332aea7e9903d99 Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Fri, 26 Dec 2014 16:09:15 +0000 Subject: [PATCH] [sanitizer] Treat \r, \n, \t as flag separators. llvm-svn: 224858 --- compiler-rt/lib/sanitizer_common/sanitizer_flags.cc | 2 +- compiler-rt/lib/sanitizer_common/tests/sanitizer_flags_test.cc | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc b/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc index 7eabb3a365a5..7cc5cfecc948 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc @@ -216,7 +216,7 @@ static bool GetFlagValue(const char *env, const char *name, end = internal_strchr(pos, '\''); } else { // Read until the next space or colon. - end = pos + internal_strcspn(pos, " :"); + end = pos + internal_strcspn(pos, " :\r\n\t"); } if (end == 0) end = pos + internal_strlen(pos); diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_flags_test.cc b/compiler-rt/lib/sanitizer_common/tests/sanitizer_flags_test.cc index 484ed446e9dd..a8962917eea9 100644 --- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_flags_test.cc +++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_flags_test.cc @@ -81,6 +81,9 @@ TEST(SanitizerCommon, MultipleFlags) { TestTwoFlags("flag2='qxx' flag1=0", false, "qxx"); TestTwoFlags("flag1=false:flag2='zzz'", false, "zzz"); TestTwoFlags("flag2=qxx:flag1=yes", true, "qxx"); + TestTwoFlags("flag2=qxx\nflag1=yes", true, "qxx"); + TestTwoFlags("flag2=qxx\r\nflag1=yes", true, "qxx"); + TestTwoFlags("flag2=qxx\tflag1=yes", true, "qxx"); } TEST(SanitizerCommon, CommonFlags) {