From e4607523234f16ed9ed0436340b9315377dbfe7f Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 2 Mar 2020 13:24:06 -0300 Subject: Fixed "conceptual" bug in 'luaK_setreturns' This function was computing invalid instruction addresses when the expression was not a multi-return instruction. (Virtually all machines don't raise errors when computing an invalid address, as long as the address is not accessed, but this computation is undefined behavior in ISO C.) --- lparser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lparser.c') diff --git a/lparser.c b/lparser.c index 8c812039..b0dbb65c 100644 --- a/lparser.c +++ b/lparser.c @@ -1014,7 +1014,8 @@ static void funcargs (LexState *ls, expdesc *f, int line) { args.k = VVOID; else { explist(ls, &args); - luaK_setmultret(fs, &args); + if (hasmultret(args.k)) + luaK_setmultret(fs, &args); } check_match(ls, ')', '(', line); break; -- cgit v1.2.3-55-g6feb