[PATCH] D35432: Only scan global sections containing data in LSan on darin

Aleksey Shlyapnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 14 17:17:25 PDT 2017


alekseyshl added inline comments.


================
Comment at: lib/lsan/lsan_common_mac.cc:114
+          internal_strcmp(range.name, "__bss") &&
+          internal_strcmp(range.name, "__common")) {
+        continue;
----------------
Maybe define an array of those and iterate over it? That will allow us to add a CHECK that literal range name length is < kMaxSegName too.


================
Comment at: lib/sanitizer_common/sanitizer_common.h:750
+          writable(writable) {
+      if (name) internal_strncpy(this->name, name, kMaxSegName);
+    }
----------------
else you need to initialize name anyway: this->name[0] = '\0';


================
Comment at: lib/sanitizer_common/sanitizer_common.h:750
+          writable(writable) {
+      if (name) internal_strncpy(this->name, name, kMaxSegName);
+    }
----------------
alekseyshl wrote:
> else you need to initialize name anyway: this->name[0] = '\0';
kMaxSegName -> ARRAY_SIZE(this->name)


================
Comment at: lib/sanitizer_common/sanitizer_procmaps_mac.cc:203
     }
+    internal_strncpy(segment->name, sc->segname, kMaxSegName);
     segment->arch = current_arch_;
----------------
kMaxSegName -> ARRAY_SZIE(segment->name)


https://reviews.llvm.org/D35432





More information about the llvm-commits mailing list