Skip to content

Commit 75c76db

Browse files
committed
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
1 parent 0943b33 commit 75c76db

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

storage/innobase/mem/mem0mem.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,8 @@ mem_heap_create_block(
404404
heap->total_size += len;
405405
}
406406

407+
UNIV_MEM_FREE(block + 1, len - MEM_BLOCK_HEADER_SIZE);
408+
407409
ut_ad((ulint)MEM_BLOCK_HEADER_SIZE < len);
408410

409411
return(block);

0 commit comments

Comments
 (0)