DynamoRIO / DynamoRIO/drmemory

ASSERT(real_end != NULL && real_end - end <= USHRT_MAX, "real_end suspicously big")

Open
#676 1 comment 0 reactions 0 assignees View on GitHub
Bug-Assert Migrated Priority-Medium
Dominant language
C
Stars
2.7k
Forks
290
PR merge metrics
No merged PRs in 30d

Description

_From [bruen...@google.com](https://code.google.com/u/109494838902877177630/) on November 08, 2011 12:09:44_

running AutomatedUITestBase.Home w/ my wrap2 tree.
it does have issue #674 WIP but I don't think that would cause something like
this.

0:023> kn
# ChildEBP RetAddr
00 12a18950 6ec583dc ntdll!ZwRaiseHardError+0x12
01 12a18994 6ec427ab dynamorio!nt_messagebox+0x7c [c:\src\dr\git\src\core\win32\ntdll.c @ 3296]
02 12a199dc 1014f23c dynamorio!dr_messagebox+0x8b [c:\src\dr\git\src\core\x86\instrument.c @ 3217]
03 12a199e8 1014f283 drmemorylib!wait_for_user+0xc [c:\src\drmemory\git\src\common\utils.c @ 96]
04 12a19a34 100c93ba drmemorylib!drmemory_abort+0x33 [c:\src\drmemory\git\src\common\utils.c @ 124]
05 12a19b70 100dc2c9 drmemorylib!malloc_add_common+0x7ca [c:\src\drmemory\git\src\common\alloc.c @ 2264]
06 12a19bb0 100db479 drmemorylib!handle_malloc_post+0x109 [c:\src\drmemory\git\src\common\alloc.c @ 4021]
07 12a19cd4 100d9ca7 drmemorylib!handle_alloc_post_func+0xfe9 [c:\src\drmemory\git\src\common\alloc.c @ 4946]
08 12a19ebc 16f761a5 drmemorylib!handle_alloc_post+0x4b7 [c:\src\drmemory\git\src\common\alloc.c @ 5014]
WARNING: Frame IP not in any known module. Following frames may be wrong.
09 12cee83c 72694d99 +0x16f161a4
0a 12cee858 72694f19 wshbth!_CRT_INIT+0xaa
0b 12cee8b8 77ac9930 wshbth!_CRT_INIT+0x22a
0c 12cee8d8 77acd8a9 ntdll!LdrpCallInitRoutine+0x14
0d 12cee9cc 77acd76c ntdll!LdrpRunInitializeRoutines+0x26f
0e 12ceeb38 77acc4b5 ntdll!LdrpLoadDll+0x4d1
0f 12ceeb70 77392288 ntdll!LdrLoadDll+0xaa
10 12ceebac 76c29b85 KERNELBASE!LoadLibraryExW+0x1f1
11 12ceee00 76c29cb6 WS2_32!NSPROVIDER::Initialize+0x5b
12 12ceee24 76c29d2e WS2_32!NSCATALOG::LoadProvider+0x4d
13 12ceee58 76c2473a WS2_32!LookupBeginEnumerationProc+0x8d
0:023> .frame 5
05 12a19b70 100dc2c9 drmemorylib!malloc_add_common+0x7ca [c:\src\drmemory\git\src\common\alloc.c @ 2264]
0:023> dv
start = 0x01160048 "???"
end = 0x011600c8 ""
real_end = 0x0117d830 "???"
pre_us = 0 ''
client_flags = 0
mc = 0x12a19d6c
post_call = 0x72694cd3 "Y???"
alloc_type = 4
e = 0x10456478
old_e = 0x16e2aac4
locked_by_me = 114 'r'
0:023> .frame 6
06 12a19bb0 100db479 drmemorylib!handle_malloc_post+0x109 [c:\src\drmemory\git\src\common\alloc.c @ 4021]
0:023> dv
drcontext = 0x20502780
mc = 0x12a19d6c
realloc = 0 ''
post_call = 0x72694cd3 "Y???"
routine = 0x12a19cb4
pad_size = 0x1d7e8
real_base = 0x01160048 "???"
pt = 0x12a225ac
app_base = 0x01160048 "???"
zeroed = 0 ''
0:023> dt pt
+0x010 auxarg : 0
+0x014 alloc_flags : 0
+0x018 alloc_size : 0x80
+0x038 in_heap_routine : 0
+0x03c in_heap_adjusted : 0
0:023> ? @@(real_end) - @@(start)
Evaluate expression: 120808 = 0001d7e8
0:023> .frame 7
07 12a19cd4 100d9ca7 drmemorylib!handle_alloc_post_func+0xfe9 [c:\src\drmemory\git\src\common\alloc.c @ 4946]
0:023> dv
drcontext = 0x20502780
mc = 0x12a19d6c
func = 0x75659cee "???"
post_call = 0x72694cd3 "Y???"
routine = struct _alloc_routine_entry_t
adjusted = 1 ''
pt = 0x12a225ac
type = HEAP_ROUTINE_MALLOC (2)
0:023> U 72694cd3-6
wshbth!_initterm_e+0x2e:
72694ccd ff15e0106972 call dword ptr [wshbth!_imp__malloc (726910e0)]

_msize is the size func for that set
0:023> U 0x75659cee
msvcrt!malloc:
0:023> ?? *routine->set->func[1]
struct _alloc_routine_entry_t
+0x000 pc : 0x7565f43b "j???"
+0x004 type : 1 ( HEAP_ROUTINE_SIZE_REQUESTED )
+0x008 name : 0x101d8818 "_msize"
+0x00c set : 0x1e763bb0
+0x010 intercept_post : 1 ''

so padded size should be call to _msize aligned to 8.
no reading of header bytes.
so what happened?
is it really a giant alloc used for a small request?
strange pad size though: looks suspicious.

0:023> dd 0x01160048-10
01160038 01180ff0 01180ff0 d3f105aa 08014334
01160048 005402b8 ffffffff 00000000 00000000
0:023> dd 0x011600c8
011600c8 00000000 00030000 00000000 00000000
011600d8 00000000 00030000 00000003 00000000
011600e8 00000000 00020000 00000001 00000000
011600f8 00000000 00020000 00000001 00000000
01160108 00000000 00020000 00000001 00000000
01160118 00000000 00000000 00000000 00000000
01160128 00000000 00000000 00000000 00000000
01160138 00000000 00000000 00000000 00000000
0:023> dd 0x0117d830
0117d830 57f93f1c 0c0279c2 00000214 00000000

_Original issue: http://code.google.com/p/drmemory/issues/detail?id=676_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.