From 6e216bea86a40eacf9fad3bf4139785278c1560b Mon Sep 17 00:00:00 2001 From: Alexander Potapenko Date: Wed, 30 May 2012 15:28:45 +0000 Subject: [PATCH] Fix a bug in parsing boolean flags: we used to take the first char of the key=value string instead of the first character of the value. llvm-svn: 157692 --- compiler-rt/lib/asan/asan_rtl.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler-rt/lib/asan/asan_rtl.cc b/compiler-rt/lib/asan/asan_rtl.cc index 19e1d9934e30..cc1d9b96578b 100644 --- a/compiler-rt/lib/asan/asan_rtl.cc +++ b/compiler-rt/lib/asan/asan_rtl.cc @@ -289,8 +289,9 @@ static void BoolFlagValue(const char *flags, const char *flag, if (!flags) return; const char *str = internal_strstr(flags, flag); if (!str) return; + const char *suffix = str + internal_strlen(flag); if (!internal_atoll(str + internal_strlen(flag))) { - if (str[0] == '0') { + if (suffix[0] == '0') { *out_val = false; return; } @@ -298,7 +299,7 @@ static void BoolFlagValue(const char *flags, const char *flag, *out_val = true; return; } - switch (str[0]) { + switch (suffix[0]) { case 'y': case 't': { *out_val = true;