aboutsummaryrefslogtreecommitdiff
path: root/lparser.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-03-02 13:24:06 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-03-02 13:24:06 -0300
commite4607523234f16ed9ed0436340b9315377dbfe7f (patch)
treeef792ad6ad9bd869c60b9a31539234e04dfa024a /lparser.c
parent92594f09395800f6f085ca7501ffd1f7aef25e22 (diff)
downloadlua-e4607523234f16ed9ed0436340b9315377dbfe7f.tar.gz
lua-e4607523234f16ed9ed0436340b9315377dbfe7f.tar.bz2
lua-e4607523234f16ed9ed0436340b9315377dbfe7f.zip
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.)
Diffstat (limited to 'lparser.c')
-rw-r--r--lparser.c3
1 files changed, 2 insertions, 1 deletions
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) {
1014 args.k = VVOID; 1014 args.k = VVOID;
1015 else { 1015 else {
1016 explist(ls, &args); 1016 explist(ls, &args);
1017 luaK_setmultret(fs, &args); 1017 if (hasmultret(args.k))
1018 luaK_setmultret(fs, &args);
1018 } 1019 }
1019 check_match(ls, ')', '(', line); 1020 check_match(ls, ')', '(', line);
1020 break; 1021 break;