Cygwin: Handle out of order modules for module offsets in stackdump

Improve address to module+offset conversion, to work correctly in the
presence of out-of-order elements in InMemoryOrderModuleList.

Fixes: d59651d4
This commit is contained in:
Jon Turney 2022-11-01 14:01:08 +00:00
parent a8526cb52b
commit 564c88b898
No known key found for this signature in database
GPG Key ID: C7C86F0370285C81
1 changed files with 3 additions and 1 deletions

View File

@ -342,11 +342,13 @@ prettyprint_va (PVOID func_va)
{
PLDR_DATA_TABLE_ENTRY mod = CONTAINING_RECORD (x, LDR_DATA_TABLE_ENTRY,
InMemoryOrderLinks);
if (mod->DllBase > func_va)
if ((func_va < mod->DllBase) ||
(func_va > (PVOID)((DWORD_PTR)mod->DllBase + mod->SizeOfImage)))
continue;
__small_sprintf (buf, "%S+0x%x", &mod->BaseDllName,
(DWORD_PTR)func_va - (DWORD_PTR)mod->DllBase);
break;
}
return buf;