dbghelp: Avoid asserting on egregiously long stabs symbol names.
Some Mac libraries have symbols which are many thousands of characters long. (Thank you, C++ templates!) It doesn't seem worth it to accommodate those by dynamically allocating the symbol name buffer, but we definitely don't want to assert. Just log an ERR. Signed-off-by: Ken Thomases <ken@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e64a2e112e
commit
c7a0d5f626
|
@ -83,7 +83,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp_stabs);
|
||||||
#define N_EXCL 0xc2
|
#define N_EXCL 0xc2
|
||||||
#define N_RBRAC 0xe0
|
#define N_RBRAC 0xe0
|
||||||
|
|
||||||
static void stab_strcpy(char* dest, int sz, const char* source)
|
static BOOL stab_strcpy(char* dest, int sz, const char* source)
|
||||||
{
|
{
|
||||||
char* ptr = dest;
|
char* ptr = dest;
|
||||||
/*
|
/*
|
||||||
|
@ -115,7 +115,7 @@ static void stab_strcpy(char* dest, int sz, const char* source)
|
||||||
while (ptr > dest && isdigit(*ptr)) ptr--;
|
while (ptr > dest && isdigit(*ptr)) ptr--;
|
||||||
if (*ptr == '.') *ptr = '\0';
|
if (*ptr == '.') *ptr = '\0';
|
||||||
}
|
}
|
||||||
assert(sz > 0);
|
return (sz > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -1134,8 +1134,12 @@ static inline void pending_add_var(struct pending_list* pending, const char* nam
|
||||||
{
|
{
|
||||||
pending_make_room(pending);
|
pending_make_room(pending);
|
||||||
pending->objs[pending->num].tag = PENDING_VAR;
|
pending->objs[pending->num].tag = PENDING_VAR;
|
||||||
stab_strcpy(pending->objs[pending->num].u.var.name,
|
if (!stab_strcpy(pending->objs[pending->num].u.var.name,
|
||||||
sizeof(pending->objs[pending->num].u.var.name), name);
|
sizeof(pending->objs[pending->num].u.var.name), name))
|
||||||
|
{
|
||||||
|
ERR("symbol too long %s\n", debugstr_a(name));
|
||||||
|
return;
|
||||||
|
}
|
||||||
pending->objs[pending->num].u.var.type = stabs_parse_type(name);
|
pending->objs[pending->num].u.var.type = stabs_parse_type(name);
|
||||||
pending->objs[pending->num].u.var.kind = dt;
|
pending->objs[pending->num].u.var.kind = dt;
|
||||||
pending->objs[pending->num].u.var.loc = *loc;
|
pending->objs[pending->num].u.var.loc = *loc;
|
||||||
|
@ -1327,8 +1331,8 @@ BOOL stabs_parse(struct module* module, ULONG_PTR load_offset,
|
||||||
stabbuf_append(&stabbuff, &stabbufflen, ptr);
|
stabbuf_append(&stabbuff, &stabbufflen, ptr);
|
||||||
ptr = stabbuff;
|
ptr = stabbuff;
|
||||||
}
|
}
|
||||||
stab_strcpy(symname, sizeof(symname), ptr);
|
if (!stab_strcpy(symname, sizeof(symname), ptr) ||
|
||||||
if (!stabs_parse_typedef(module, ptr, symname))
|
!stabs_parse_typedef(module, ptr, symname))
|
||||||
{
|
{
|
||||||
/* skip this definition */
|
/* skip this definition */
|
||||||
stabbuff[0] = '\0';
|
stabbuff[0] = '\0';
|
||||||
|
@ -1348,7 +1352,12 @@ BOOL stabs_parse(struct module* module, ULONG_PTR load_offset,
|
||||||
*
|
*
|
||||||
* With a.out or mingw, they actually do make some amount of sense.
|
* With a.out or mingw, they actually do make some amount of sense.
|
||||||
*/
|
*/
|
||||||
stab_strcpy(symname, sizeof(symname), ptr);
|
if (!stab_strcpy(symname, sizeof(symname), ptr))
|
||||||
|
{
|
||||||
|
ERR("symbol too long: %s\n", debugstr_a(ptr));
|
||||||
|
stabbuff[0] = '\0';
|
||||||
|
continue;
|
||||||
|
}
|
||||||
loc.kind = loc_absolute;
|
loc.kind = loc_absolute;
|
||||||
loc.reg = 0;
|
loc.reg = 0;
|
||||||
loc.offset = load_offset + n_value;
|
loc.offset = load_offset + n_value;
|
||||||
|
@ -1358,7 +1367,12 @@ BOOL stabs_parse(struct module* module, ULONG_PTR load_offset,
|
||||||
case N_LCSYM:
|
case N_LCSYM:
|
||||||
case N_STSYM:
|
case N_STSYM:
|
||||||
/* These are static symbols and BSS symbols. */
|
/* These are static symbols and BSS symbols. */
|
||||||
stab_strcpy(symname, sizeof(symname), ptr);
|
if (!stab_strcpy(symname, sizeof(symname), ptr))
|
||||||
|
{
|
||||||
|
ERR("symbol too long: %s\n", debugstr_a(ptr));
|
||||||
|
stabbuff[0] = '\0';
|
||||||
|
continue;
|
||||||
|
}
|
||||||
loc.kind = loc_absolute;
|
loc.kind = loc_absolute;
|
||||||
loc.reg = 0;
|
loc.reg = 0;
|
||||||
loc.offset = load_offset + n_value;
|
loc.offset = load_offset + n_value;
|
||||||
|
@ -1383,7 +1397,12 @@ BOOL stabs_parse(struct module* module, ULONG_PTR load_offset,
|
||||||
if (curr_func != NULL)
|
if (curr_func != NULL)
|
||||||
{
|
{
|
||||||
struct symt* param_type = stabs_parse_type(ptr);
|
struct symt* param_type = stabs_parse_type(ptr);
|
||||||
stab_strcpy(symname, sizeof(symname), ptr);
|
if (!stab_strcpy(symname, sizeof(symname), ptr))
|
||||||
|
{
|
||||||
|
ERR("symbol too long: %s\n", debugstr_a(ptr));
|
||||||
|
stabbuff[0] = '\0';
|
||||||
|
continue;
|
||||||
|
}
|
||||||
loc.kind = loc_regrel;
|
loc.kind = loc_regrel;
|
||||||
loc.reg = dbghelp_current_cpu->frame_regno;
|
loc.reg = dbghelp_current_cpu->frame_regno;
|
||||||
loc.offset = n_value;
|
loc.offset = n_value;
|
||||||
|
@ -1442,7 +1461,12 @@ BOOL stabs_parse(struct module* module, ULONG_PTR load_offset,
|
||||||
loc.reg = CV_REG_NONE;
|
loc.reg = CV_REG_NONE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
stab_strcpy(symname, sizeof(symname), ptr);
|
if (!stab_strcpy(symname, sizeof(symname), ptr))
|
||||||
|
{
|
||||||
|
ERR("symbol too long: %s\n", debugstr_a(ptr));
|
||||||
|
stabbuff[0] = '\0';
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (ptr[strlen(symname) + 1] == 'P')
|
if (ptr[strlen(symname) + 1] == 'P')
|
||||||
{
|
{
|
||||||
struct symt* param_type = stabs_parse_type(ptr);
|
struct symt* param_type = stabs_parse_type(ptr);
|
||||||
|
@ -1494,7 +1518,12 @@ BOOL stabs_parse(struct module* module, ULONG_PTR load_offset,
|
||||||
* all of the pages related to the stabs, and that
|
* all of the pages related to the stabs, and that
|
||||||
* sucks up swap space like crazy.
|
* sucks up swap space like crazy.
|
||||||
*/
|
*/
|
||||||
stab_strcpy(symname, sizeof(symname), ptr);
|
if (!stab_strcpy(symname, sizeof(symname), ptr))
|
||||||
|
{
|
||||||
|
ERR("symbol too long: %s\n", debugstr_a(ptr));
|
||||||
|
stabbuff[0] = '\0';
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (*symname)
|
if (*symname)
|
||||||
{
|
{
|
||||||
struct symt_function_signature* func_type;
|
struct symt_function_signature* func_type;
|
||||||
|
@ -1620,7 +1649,12 @@ BOOL stabs_parse(struct module* module, ULONG_PTR load_offset,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*ptr == '_') ptr++;
|
if (*ptr == '_') ptr++;
|
||||||
stab_strcpy(symname, sizeof(symname), ptr);
|
if (!stab_strcpy(symname, sizeof(symname), ptr))
|
||||||
|
{
|
||||||
|
ERR("symbol too long: %s\n", debugstr_a(ptr));
|
||||||
|
stabbuff[0] = '\0';
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
callback(module, load_offset, symname, n_value,
|
callback(module, load_offset, symname, n_value,
|
||||||
is_public, is_global, stab_ptr->n_other, compiland, user);
|
is_public, is_global, stab_ptr->n_other, compiland, user);
|
||||||
|
|
Loading…
Reference in New Issue