From: Eric Pouech <eric.pouech(a)gmail.com> GCC 12.2 rightfully complains about an out-of-founds array access. This can possibly happen for unsupported variable names. This is a rudimentary fix (don't write outside of array), but current code will require more cudling (eg: native runs the loop for every parsed token even if the variable name isn't supported) while builtin stops parsing. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> --- programs/cmd/builtins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index 82008c3ec7a..4856b619812 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -2025,7 +2025,7 @@ static void WCMD_parse_line(CMD_LIST *cmdStart, } /* Execute the body of the foor loop with these values */ - if (forloopcontext.variable[varidx] && forloopcontext.variable[varidx][0] != forf_eol) { + if (varidx >= 0 && forloopcontext.variable[varidx] && forloopcontext.variable[varidx][0] != forf_eol) { CMD_LIST *thisCmdStart = cmdStart; *doExecuted = TRUE; WCMD_part_execute(&thisCmdStart, firstCmd, FALSE, TRUE); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1346