winedump: Fix out of bounds access (spotted by GCC13).

Anyway, it's a pain that we have to maintain two MS symbols
demanglers (this one and the one in dlls/msvcrt).

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
This commit is contained in:
Eric Pouech 2023-04-04 19:02:43 +02:00 committed by Alexandre Julliard
parent 9015565ac0
commit 020b6e094f

View file

@ -573,10 +573,10 @@ static char *demangle_datatype (char **str, compound_type *ct,
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
/* Referring back to previously parsed type */
if (sym->argc >= (size_t)('0' - *iter))
if (sym->argc >= (size_t)(*iter - '0'))
return NULL;
ct->dest_type = sym->arg_type ['0' - *iter];
ct->expression = xstrdup (sym->arg_text ['0' - *iter]);
ct->dest_type = sym->arg_type [*iter - '0'];
ct->expression = xstrdup (sym->arg_text [*iter - '0']);
iter++;
break;
default :