[PATCH] D25946: [compiler-rt][asan] Add support for desallocation of unhandled pointers

Etienne Bergeron via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 14 08:36:18 PST 2017


etienneb added inline comments.


================
Comment at: lib/asan/asan_win.cc:282
+  MEMORY_BASIC_INFORMATION mem_info = {};
+  if (::VirtualQuery((LPVOID)addr, &mem_info, sizeof(mem_info)) == 0 ||
+      mem_info.State == MEM_FREE) {
----------------
rnk wrote:
> This is too broad. This will suppress invalid free checks on any pointer from VirtualAlloc. Why not use HeapValidate? It appears to support checking a single block efficiently: https://msdn.microsoft.com/en-us/library/windows/desktop/aa366708(v=vs.85).aspx
Are we assuming?
 1) no custom memory management (direct access to virtual-alloc/free)?
 2) no other heap (only the default process heap

And I'm not sure |lpMem| can be any arbitrary pointer within the memory chunk. I suspect it must be the begining of the block.


https://reviews.llvm.org/D25946





More information about the llvm-commits mailing list