Valgrind or something like that.
Addresssanitizer
Besides Heap,stack, it can be.
Https://en.wikipedia.org/wiki/AddressSanitizer#Stack-buffer-overflow
http://developerblog.redhat.com/2014/12/02/address-and-thread-sanitizers-gcc/
Page Fence of Tcmalloc
Limitation is that the heap can only be checked for cross-read and write
Http://www.xuebuyuan.com/1466812.html
Http://gperftools.googlecode.com/files/gperftools-2.0.tar.gz
changed the code, a file that has the memory out of bounds check turned on. Modify the following:
Sed-i "S/envtobool (\" Tcmalloc_page_fence\ ", false)/envtobool (\" Tcmalloc_page_fence\ ", true)/g" src/ debugallocation.cc
It means:
Src/debugallocation.cc:101
Define_bool (Malloc_page_fence,
Envtobool ("Tcmalloc_page_fence", false),
"Enables putting of memory allocations at page boundaries"
"With a guard page following the allocation (to catch buffer"
"Overruns right when they happen).");
Will
Envtobool ("Tcmalloc_page_fence", false)
Changed it.
Envtobool ("Tcmalloc_page_fence", True)
CD gperftools-2.0 &&./configure--enable-frame-pointers && make
Check for illegal read and write operation of memory