[llvm-commits] [PATCH] [ASan] Use dylib interposition to hook memory allocation in the dynamic runtime.
Alexander Potapenko
glider at google.com
Tue Jan 22 00:44:51 PST 2013
================
Comment at: asan_malloc_mac.cc:86
@@ +85,3 @@
+ internal_snprintf(new_name.data(), buflen, "asan-%s", name);
+ new_name.data()[buflen - 1] = '\0';
+ name = new_name.data();
----------------
Alexey Samsonov wrote:
> I think that internal_snprintf() adds a trailing \0
It sure does. Something clicked in my head and made me apply the bug mitigation pattern used for strncpy :)
Thanks for catching this!
================
Comment at: asan_malloc_mac.cc:46
@@ +45,3 @@
+ malloc_zone_t *new_zone =
+ (malloc_zone_t*)asan_malloc(sizeof(malloc_zone_t), &stack);
+ internal_memcpy(new_zone, &asan_zone, sizeof(malloc_zone_t));
----------------
Alexey Samsonov wrote:
> I think lint would advice you to prefer sizeof(asan_zone)
Done. Although I'm a bit unsure about this since I'm not allocating asan_zone itself.
================
Comment at: lit_tests/malloc_delete_mismatch.cc:1
@@ -1,2 @@
-// Check that we detect malloc/delete mismatch only if the approptiate flag
-// is set.
----------------
Alexey Samsonov wrote:
> Did you move this file somewhere?
Yes. Let me upload another diff.
http://llvm-reviews.chandlerc.com/D216
More information about the llvm-commits
mailing list