summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorEugene Kosov <claprix@yandex.ru>2018-03-19 16:18:53 +0300
committerEugene Kosov <claprix@yandex.ru>2018-03-19 16:18:53 +0300
commit75c76dbb06a99359d867e2a516f3244bf41fde96 (patch)
tree4dafb44a0e03d5f063b7e1d332d2b21fe0eb8b06 /storage
parent0943b33de3daa0fcbf58803be8e991941de63218 (diff)
downloadmariadb-git-75c76dbb06a99359d867e2a516f3244bf41fde96.tar.gz
MDEV-15030 Add ASAN instrumentation
Learn both valgrind and asan to catch this bug: mem_heap_t* heap = mem_heap_create(1024); byte* p = reinterpret_cast<byte*>(heap) + sizeof(mem_heap_t); *p = 123; Overflows of the last allocation in a block will be catched too. mem_heap_create_block(): poison newly allocated memory
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/mem/mem0mem.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/storage/innobase/mem/mem0mem.c b/storage/innobase/mem/mem0mem.c
index 6e9a39d329f..31f235b1960 100644
--- a/storage/innobase/mem/mem0mem.c
+++ b/storage/innobase/mem/mem0mem.c
@@ -404,6 +404,8 @@ mem_heap_create_block(
heap->total_size += len;
}
+ UNIV_MEM_FREE(block + 1, len - MEM_BLOCK_HEADER_SIZE);
+
ut_ad((ulint)MEM_BLOCK_HEADER_SIZE < len);
return(block);