msvcrt: symbol undecoration: Really check that we get a template string before making use of it.

This commit is contained in:
Eric Pouech 2008-01-21 22:06:11 +01:00 committed by Alexandre Julliard
parent 95cff6c8f9
commit 0920f8e778
2 changed files with 9 additions and 5 deletions

View File

@ -984,6 +984,7 @@ static void test_demangle(void)
{"?$AAA@$DBAB@", "AAA<`template-parameter257'>"},
{"?$AAA@$D?4@", "AAA<`template-parameter-5'>"},
{"?$AAA@PAUBBB@@", "AAA<struct BBB *>"},
{"??$ccccc@PAVaaa@@@bar@bb@foo@@DGPAV0@PAV0@PAVee@@IPAPAVaaa@@1@Z", "private: static class bar * __stdcall foo::bb::bar::ccccc<class aaa *>(class bar *,class ee *,unsigned int,class aaa **,class ee *)"},
};
int i, num_test = (sizeof(test)/sizeof(test[0]));
char* name;

View File

@ -538,8 +538,8 @@ static BOOL get_class(struct parsed_symbol* sym)
if (*++sym->current == '$')
{
sym->current++;
name = get_template_name(sym);
str_array_push(sym, name, -1, &sym->names);
if ((name = get_template_name(sym)))
str_array_push(sym, name, -1, &sym->names);
}
break;
default:
@ -1292,17 +1292,17 @@ static BOOL symbol_demangle(struct parsed_symbol* sym)
str_array_push(sym, function_name, -1, &sym->stack);
break;
}
sym->stack.start = 1;
}
else if (*sym->current == '$')
{
/* Strange construct, it's a name with a template argument list
and that's all. */
sym->current++;
sym->result = get_template_name(sym);
ret = TRUE;
ret = (sym->result = get_template_name(sym)) != NULL;
goto done;
}
else if (*sym->current == '?' && sym->current[1] == '$')
do_after = 5;
/* Either a class name, or '@' if the symbol is not a class member */
switch (*sym->current)
@ -1331,6 +1331,9 @@ static BOOL symbol_demangle(struct parsed_symbol* sym)
case 3:
sym->flags &= ~UNDNAME_NO_FUNCTION_RETURNS;
break;
case 5:
sym->names.start = 1;
break;
}
/* Function/Data type and access level */