lua

A copy of the Lua development repository
Log | Files | Refs | README

commit cac075a1221f373053196dbb24bdcff4609b8241
parent 9e0a8475cdd53af664b807c4f0c4d53088a7faf2
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Thu, 23 Apr 2020 14:39:07 -0300

Small issue in 'exprstat'

The code should not compute an instruction address before checking that
it exists. (Virtually no machine complains of computing an invalid
address, as long as the address is not used, but for ISO C that is
undefined behavior.)

Diffstat:
Mlparser.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lparser.c b/lparser.c @@ -1822,8 +1822,9 @@ static void exprstat (LexState *ls) { restassign(ls, &v, 1); } else { /* stat -> func */ - Instruction *inst = &getinstruction(fs, &v.v); + Instruction *inst; check_condition(ls, v.v.k == VCALL, "syntax error"); + inst = &getinstruction(fs, &v.v); SETARG_C(*inst, 1); /* call statement uses no results */ } }