--scribble_heap, which memsets all allocated memory.
Already exposing bugs.
This commit is contained in:
parent
082df81f70
commit
6477d6c21e
|
@ -40,6 +40,9 @@ DEFINE_bool(
|
|||
DEFINE_uint64(
|
||||
heap_guard_pages, 0,
|
||||
"Allocate the given number of guard pages around all heap chunks.");
|
||||
DEFINE_bool(
|
||||
scribble_heap, false,
|
||||
"Scribble 0xCD into all allocated heap memory.");
|
||||
|
||||
|
||||
/**
|
||||
|
@ -524,6 +527,11 @@ uint32_t xe_memory_heap_t::Alloc(
|
|||
PAGE_READWRITE);
|
||||
}
|
||||
|
||||
if (FLAGS_scribble_heap) {
|
||||
// Trash the memory so that we can see bad read-before-write bugs easier.
|
||||
memset(p, 0xCD, alloc_size);
|
||||
}
|
||||
|
||||
return (uint32_t)((uintptr_t)p - (uintptr_t)memory->mapping_base);
|
||||
}
|
||||
|
||||
|
@ -539,6 +547,11 @@ uint32_t xe_memory_heap_t::Free(uint32_t address, uint32_t size) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (FLAGS_scribble_heap) {
|
||||
// Trash the memory so that we can see bad read-before-write bugs easier.
|
||||
memset(p, 0xDC, size);
|
||||
}
|
||||
|
||||
XEIGNORE(xe_mutex_lock(mutex));
|
||||
if (FLAGS_heap_guard_pages) {
|
||||
DWORD old_protect;
|
||||
|
|
Loading…
Reference in New Issue