mirror of
git://source.winehq.org/git/wine.git
synced 2024-07-22 00:54:09 +00:00
dbghelp: Better handle very long C++ qualified identifiers in dwarf.
This fixes some crashes especially when dealing with very long C++ names (like template classes). Fortunately, dwarf internals don't require type lookup by name (eg. on forward declaration), so the impact of thrashing some names is limited. It's very likely native doesn't store directly these very long names (it could either store the qualified mangled name - which can be way shorter for template classes - or use the names in lexical hierarchy: both boil down to storing less information, and recompute it (unmangle or class hierarchy walk) upon request). But this would need a proper C++ support in dbghelp. Not for today. Signed-off-by: Eric Pouech <epouech@codeweavers.com>
This commit is contained in:
parent
0db9f33b7d
commit
542ccaaf84
|
@ -1177,7 +1177,10 @@ static const char* dwarf2_get_cpp_name(dwarf2_debug_info_t* di, const char* name
|
|||
}
|
||||
|
||||
if (!di->unit_ctx->cpp_name)
|
||||
{
|
||||
di->unit_ctx->cpp_name = pool_alloc(&di->unit_ctx->pool, MAX_SYM_NAME);
|
||||
if (!di->unit_ctx->cpp_name) return name;
|
||||
}
|
||||
last = di->unit_ctx->cpp_name + MAX_SYM_NAME - strlen(name) - 1;
|
||||
strcpy(last, name);
|
||||
|
||||
|
@ -1194,7 +1197,11 @@ static const char* dwarf2_get_cpp_name(dwarf2_debug_info_t* di, const char* name
|
|||
{
|
||||
size_t len = strlen(diname.u.string);
|
||||
last -= 2 + len;
|
||||
if (last < di->unit_ctx->cpp_name) return NULL;
|
||||
if (last < di->unit_ctx->cpp_name)
|
||||
{
|
||||
WARN("Too long C++ qualified identifier for %s... using unqualified identifier\n", name);
|
||||
return name;
|
||||
}
|
||||
memcpy(last, diname.u.string, len);
|
||||
last[len] = last[len + 1] = ':';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue