diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-06-16 10:35:01 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-06-16 10:35:01 -0300 |
commit | d4dce57f5ca64c65c7c49eac683b8f807e8dc02d (patch) | |
tree | 59cd92fbd9687d00aa8fd8f94ece538c8d7c6c35 /lparser.c | |
parent | 5c19ed2a13af8cdf364867ea66f9827bc139d06b (diff) | |
download | lua-d4dce57f5ca64c65c7c49eac683b8f807e8dc02d.tar.gz lua-d4dce57f5ca64c65c7c49eac683b8f807e8dc02d.tar.bz2 lua-d4dce57f5ca64c65c7c49eac683b8f807e8dc02d.zip |
cannot assign to unlimited variables, because it causes overflow in
the number of returns of a function.
Diffstat (limited to 'lparser.c')
-rw-r--r-- | lparser.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 1.34 1999/05/21 19:54:06 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 1.35 1999/06/16 13:22:04 roberto Exp roberto $ |
3 | ** LL(1) Parser and code generator for Lua | 3 | ** LL(1) Parser and code generator for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -39,6 +39,11 @@ | |||
39 | #define SMAXUPVALUES "32" | 39 | #define SMAXUPVALUES "32" |
40 | 40 | ||
41 | 41 | ||
42 | /* maximum number of variables in the left side of an assignment */ | ||
43 | #define MAXVARSLH 100 | ||
44 | #define SMAXVARSLH "100" | ||
45 | |||
46 | |||
42 | /* | 47 | /* |
43 | ** Variable descriptor: | 48 | ** Variable descriptor: |
44 | ** must include an "exp" option because LL(1) cannot distinguish | 49 | ** must include an "exp" option because LL(1) cannot distinguish |
@@ -1221,6 +1226,9 @@ static void decinit (LexState *ls, listdesc *d) { | |||
1221 | 1226 | ||
1222 | static int assignment (LexState *ls, vardesc *v, int nvars) { | 1227 | static int assignment (LexState *ls, vardesc *v, int nvars) { |
1223 | int left = 0; | 1228 | int left = 0; |
1229 | if (nvars > MAXVARSLH) | ||
1230 | luaX_error(ls, "too many variables in a multiple assignment " | ||
1231 | MES_LIM(SMAXVARSLH)); | ||
1224 | unloaddot(ls, v); | 1232 | unloaddot(ls, v); |
1225 | if (ls->token == ',') { /* assignment -> ',' NAME assignment */ | 1233 | if (ls->token == ',') { /* assignment -> ',' NAME assignment */ |
1226 | vardesc nv; | 1234 | vardesc nv; |