[compiler-rt] r209814 - [sanitizer] Require that options end with '='.

Evgeniy Stepanov eugeni.stepanov at gmail.com
Thu May 29 07:32:32 PDT 2014


Author: eugenis
Date: Thu May 29 09:32:32 2014
New Revision: 209814

URL: http://llvm.org/viewvc/llvm-project?rev=209814&view=rev
Log:
[sanitizer] Require that options end with '='.

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc?rev=209814&r1=209813&r2=209814&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc Thu May 29 09:32:32 2014
@@ -150,14 +150,17 @@ static bool GetFlagValue(const char *env
     pos = internal_strstr(env, name);
     if (pos == 0)
       return false;
-    if (pos != env && ((pos[-1] >= 'a' && pos[-1] <= 'z') || pos[-1] == '_')) {
+    const char *name_end = pos + internal_strlen(name);
+    if ((pos != env &&
+         ((pos[-1] >= 'a' && pos[-1] <= 'z') || pos[-1] == '_')) ||
+        *name_end != '=') {
       // Seems to be middle of another flag name or value.
       env = pos + 1;
       continue;
     }
+    pos = name_end;
     break;
   }
-  pos += internal_strlen(name);
   const char *end;
   if (pos[0] != '=') {
     end = pos;





More information about the llvm-commits mailing list