[PATCH] D17690: [asan] Check if the memory is readable before using the AsanChunk in free() and realloc()

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 29 10:53:10 PST 2016


kcc added inline comments.

================
Comment at: lib/asan/asan_allocator.cc:527
@@ -525,1 +526,3 @@
     AsanChunk *m = reinterpret_cast<AsanChunk *>(chunk_beg);
+    if (!IsAccessibleMemoryRange((uptr)m, sizeof(AsanChunk)))
+      ReportFreeNotMalloced((uptr)ptr, stack);
----------------
Oh, yes, I've totally missed this. For some reason I thought this is on the error-reporting path. 
Thanks Alexey. 
Yes, on the main path we can't do this. 


http://reviews.llvm.org/D17690





More information about the llvm-commits mailing list