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 | |
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.
-rw-r--r-- | bugs | 10 | ||||
-rw-r--r-- | lparser.c | 10 |
2 files changed, 17 insertions, 3 deletions
@@ -88,11 +88,17 @@ Thu Mar 4 11:49:37 EST 1999 | |||
88 | ** lstrlib.c | 88 | ** lstrlib.c |
89 | Fri Apr 30 11:10:20 EST 1999 | 89 | Fri Apr 30 11:10:20 EST 1999 |
90 | >> '$' at end of pattern was matching regular '$', too. | 90 | >> '$' at end of pattern was matching regular '$', too. |
91 | (by anna) | 91 | (by anna; since 2.5) |
92 | 92 | ||
93 | ** lbuiltin.c | 93 | ** lbuiltin.c |
94 | Fri May 21 17:15:11 EST 1999 | 94 | Fri May 21 17:15:11 EST 1999 |
95 | >> foreach, foreachi, foreachvar points to function in stack when stack | 95 | >> foreach, foreachi, foreachvar points to function in stack when stack |
96 | can be reallocated. | 96 | can be reallocated. |
97 | (by tomas) | 97 | (by tomas; since 3.2 beta) |
98 | |||
99 | ** lparser.c | ||
100 | Wed Jun 16 10:32:46 EST 1999 | ||
101 | >> cannot assign to unlimited variables, because it causes overflow in | ||
102 | the number of returns of a function. | ||
103 | (since 3.1) | ||
98 | 104 | ||
@@ -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; |