You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
% grep 0x01279d5 drmemory/drmemory/logs/DrMemory-buggy.exe.6116.000/global.6116.log
replace_RtlAllocateHeap heap=0x00790000 (=> 0x01270000) flags=0x8 size=0x200
carving out new chunk @0x01279d38 => head=0x01279d40, res=0x01279d58
replace_alloc_common arena=0x01270000 flags=0x804 request=512, align=8 alloc=512 => 0x01279d58
set range 0x01279d58-0x01279f58 => 0x0
replace_free 0x01279d58
ptr_is_in_arena: 0x01279d58 not found in arena 0x01a70000
Error #5: INVALID HEAP ARGUMENT to free 0x01279d58
process heap=0x00790000
create_Rtl_heap commit=0x20000 reserve=0x400000 flags=0x2 => 0x01270000
adding heap region 0x01270000-0x01670000 arena
set heap region 0x01270000-0x01670000 Heap to 0x01270000
pre-existing Heap for libc set type=0 module=buggy.exe is 0x00000000
create_Rtl_heap commit=0x1000 reserve=0x400000 flags=0x2 => 0x01a70000
adding heap region 0x01a70000-0x01e70000 arena
set heap region 0x01a70000-0x01e70000 Heap to 0x01a70000
new default Heap for libc set type=0 @0x012385e3 modbase=0x011b0000 is 0x01a70000
The bug is that it wants to use buggy.exe's libc arena 0x01a70000 on the
free, yet the alloc used the global arena.
// Initializes the heap. This function must be called during CRT startup, and
// must be called before any user code that might use the heap is executed.
extern "C" bool __cdecl __acrt_initialize_heap()
{
__acrt_heap = GetProcessHeap();
So this is #1223 where VS2012+ use the process heap: we're supposed to wait for the first invocation of malloc.
Yet our first alloc is:
replace_operator_new 0x8
libc_heap_handle: for 0x01230000 func is 0x00000000
sym lookup of _crtheap in C:\derek\cgo2016\demos\buggy.exe => symcache hit 0 of 1 == 0x0
check_libc_vs_process_heap: modbase 0x01230000 arena 0x01af0000 heap 0x00000000
replace_operator_new size=8 abort_on_oom=1 type=8
carving out new chunk @0x01af00d8 => head=0x01af00e0, res=0x01af00f8
replace_alloc_common arena=0x01af0000 flags=0x8 request=8, align=8 alloc=8 => 0x01af00f8
@@@ unique callstack #17
#0 replace_operator_new [d:\drmemory_package\common\alloc_replace.c:2899]
#1 std::basic_streambuf<>::basic_streambuf<> [f:\dd\vctools\crt\crtw32\stdhpp\streambuf:26]
#2 std::`dynamic initializer for 'fout'' [f:\dd\vctools\crt\crtw32\stdcpp\cout.cpp:12]
#3 __scrt_common_main_seh [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:230]
#4 KERNEL32.dll!BaseThreadInitThunk +0x23 (0x744938f4 <KERNEL32.dll+0x138f4>)
So the culprit is: they renamed _crtheap to __acrt_heap.
The text was updated successfully, but these errors were encountered:
I experience the same issue (invalid heap + leak, at the same address, but pretending "-1") when using vs2017/vs2019 built projects.
Unfortunately I do not have any simple example (it's some omniorb in VS2019 and project in VS2017).
(Dr. Memory version 2.5.0 build 0)
I'm wondering if this can be fixed in some more fundamental way, as it somehow does not make much sense to me that x - x = -1 is a problem of a symbol mismatch, or so...
Running a trivial app built with VS2015:
Xref #1428.
Xref #500 -- "mismatch b/c operator new calls _nh_malloc_dbg"
It's in our own default arena:
The bug is that it wants to use buggy.exe's libc arena 0x01a70000 on the
free, yet the alloc used the global arena.
Here's more about the alloc:
calloc_base.cpp:
heap_handle.cpp:
So this is #1223 where VS2012+ use the process heap: we're supposed to wait for the first invocation of malloc.
Yet our first alloc is:
So the culprit is: they renamed _crtheap to __acrt_heap.
The text was updated successfully, but these errors were encountered: