diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-04-23 14:39:34 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-04-23 14:39:34 -0300 |
commit | cac075a1221f373053196dbb24bdcff4609b8241 (patch) | |
tree | e3633c7457ef091b3da81dec6a8f609b9eb432f5 | |
parent | 9e0a8475cdd53af664b807c4f0c4d53088a7faf2 (diff) | |
download | lua-cac075a1221f373053196dbb24bdcff4609b8241.tar.gz lua-cac075a1221f373053196dbb24bdcff4609b8241.tar.bz2 lua-cac075a1221f373053196dbb24bdcff4609b8241.zip |
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.)
-rw-r--r-- | lparser.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -1822,8 +1822,9 @@ static void exprstat (LexState *ls) { | |||
1822 | restassign(ls, &v, 1); | 1822 | restassign(ls, &v, 1); |
1823 | } | 1823 | } |
1824 | else { /* stat -> func */ | 1824 | else { /* stat -> func */ |
1825 | Instruction *inst = &getinstruction(fs, &v.v); | 1825 | Instruction *inst; |
1826 | check_condition(ls, v.v.k == VCALL, "syntax error"); | 1826 | check_condition(ls, v.v.k == VCALL, "syntax error"); |
1827 | inst = &getinstruction(fs, &v.v); | ||
1827 | SETARG_C(*inst, 1); /* call statement uses no results */ | 1828 | SETARG_C(*inst, 1); /* call statement uses no results */ |
1828 | } | 1829 | } |
1829 | } | 1830 | } |