[PATCH] D47960: [asan, myriad] Support environment variables

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 11 11:34:25 PDT 2018


vitalybuka added inline comments.


================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_rtems.cc:39
+// This variable needs to not be in .bss because we don't want
+// zero-initialization by the OS.
+char __sanitizer_env[__sanitizer_env_len] __attribute__((section(".data")));
----------------
why?


================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_rtems.cc:41
+char __sanitizer_env[__sanitizer_env_len] __attribute__((section(".data")));
+
 namespace __sanitizer {
----------------
Howe about making it static and add __sanitizer::SetEnvForTest()



================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_rtems.cc:253
+  // To avoid buffer overrun, give up if buffer is not null terminated.
+  if (env[env_len - 1] != '\0')
+    return nullptr;
----------------
how this can happen?


================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_rtems.cc:259
+  uptr i = 0;
+  while (i <= end) {
+    if (internal_strncmp(&env[i], name, name_len) == 0 &&
----------------
for (uptr i = 0; i <= end; i += internal_strlen(env) + 1)


Repository:
  rL LLVM

https://reviews.llvm.org/D47960





More information about the llvm-commits mailing list