Commit 75c76dbb authored by Eugene Kosov's avatar Eugene Kosov

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
parent 0943b33d
...@@ -404,6 +404,8 @@ mem_heap_create_block( ...@@ -404,6 +404,8 @@ mem_heap_create_block(
heap->total_size += len; heap->total_size += len;
} }
UNIV_MEM_FREE(block + 1, len - MEM_BLOCK_HEADER_SIZE);
ut_ad((ulint)MEM_BLOCK_HEADER_SIZE < len); ut_ad((ulint)MEM_BLOCK_HEADER_SIZE < len);
return(block); return(block);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment