diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-07-12 16:02:50 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-07-12 16:02:50 -0300 |
commit | 0782416a747a8ebb3570f3ac84918eaa4386f213 (patch) | |
tree | d3292e11bc2f2d35f51bb4c1d4a1f9380e956927 | |
parent | 3ca9af51a4f060cf2178901a67a21f8269af3224 (diff) | |
download | lua-0782416a747a8ebb3570f3ac84918eaa4386f213.tar.gz lua-0782416a747a8ebb3570f3ac84918eaa4386f213.tar.bz2 lua-0782416a747a8ebb3570f3ac84918eaa4386f213.zip |
bug: wrong limit for list constructors
-rw-r--r-- | bugs | 32 | ||||
-rw-r--r-- | lparser.c | 4 |
2 files changed, 34 insertions, 2 deletions
@@ -1013,3 +1013,35 @@ patch = [[ | |||
1013 | ]], | 1013 | ]], |
1014 | 1014 | ||
1015 | } | 1015 | } |
1016 | |||
1017 | Bug{ | ||
1018 | what = [[list constructors have wrong limit]], | ||
1019 | |||
1020 | report = [[by Norman Ramsey, June 2006]], | ||
1021 | |||
1022 | since = "Lua 5.1", | ||
1023 | |||
1024 | example = [[ | ||
1025 | a = {} | ||
1026 | a[1] = "x={1" | ||
1027 | for i = 2, 2^20 do | ||
1028 | a[i] = 1 | ||
1029 | end | ||
1030 | a[#a + 1] = "}" | ||
1031 | s = table.concat(a, ",") | ||
1032 | assert(loadstring(s))() | ||
1033 | print(#x) | ||
1034 | ]], | ||
1035 | |||
1036 | patch = [[ | ||
1037 | * lparser.c: | ||
1038 | static void listfield (LexState *ls, struct ConsControl *cc) { | ||
1039 | expr(ls, &cc->v); | ||
1040 | - luaY_checklimit(ls->fs, cc->na, MAXARG_Bx, "items in a constructor"); | ||
1041 | + luaY_checklimit(ls->fs, cc->na, MAX_INT, "items in a constructor"); | ||
1042 | cc->na++; | ||
1043 | cc->tostore++; | ||
1044 | } | ||
1045 | ]], | ||
1046 | |||
1047 | } | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 2.43 2006/06/22 16:12:59 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.44 2006/07/11 15:53:29 roberto Exp roberto $ |
3 | ** Lua Parser | 3 | ** Lua Parser |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -495,7 +495,7 @@ static void lastlistfield (FuncState *fs, struct ConsControl *cc) { | |||
495 | 495 | ||
496 | static void listfield (LexState *ls, struct ConsControl *cc) { | 496 | static void listfield (LexState *ls, struct ConsControl *cc) { |
497 | expr(ls, &cc->v); | 497 | expr(ls, &cc->v); |
498 | luaY_checklimit(ls->fs, cc->na, MAXARG_Bx, "items in a constructor"); | 498 | luaY_checklimit(ls->fs, cc->na, MAX_INT, "items in a constructor"); |
499 | cc->na++; | 499 | cc->na++; |
500 | cc->tostore++; | 500 | cc->tostore++; |
501 | } | 501 | } |