aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-12-21 15:30:31 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-12-21 15:30:31 -0200
commit9d2e454d6f42f86faf645a4a24f66023846ea9ab (patch)
treefd77170dc472eeb7f4b9d750933ca0700d5e6ad6
parent09e15692f3a237e2858cc67e2e7f07c3e4c983e7 (diff)
downloadlua-9d2e454d6f42f86faf645a4a24f66023846ea9ab.tar.gz
lua-9d2e454d6f42f86faf645a4a24f66023846ea9ab.tar.bz2
lua-9d2e454d6f42f86faf645a4a24f66023846ea9ab.zip
BUG: seg. fault when rawget/rawset get extra arguments
-rw-r--r--bugs7
-rw-r--r--lbaselib.c6
2 files changed, 10 insertions, 3 deletions
diff --git a/bugs b/bugs
index 0b245d31..abb5d9f7 100644
--- a/bugs
+++ b/bugs
@@ -270,3 +270,10 @@ Tue Jul 10 16:59:18 EST 2001
270>> error message for `%a' gave wrong line number 270>> error message for `%a' gave wrong line number
271(by Leonardo Constantino; since 4.0) 271(by Leonardo Constantino; since 4.0)
272 272
273** lbaselib.c
274Fri Dec 21 15:21:05 EDT 2001
275>> seg. fault when rawget/rawset get extra arguments
276(by Eric Mauger; since 4.0b)
277
278
279
diff --git a/lbaselib.c b/lbaselib.c
index 77656e12..cb914f18 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -185,7 +185,7 @@ static int luaB_globals (lua_State *L) {
185static int luaB_rawget (lua_State *L) { 185static int luaB_rawget (lua_State *L) {
186 luaL_check_type(L, 1, LUA_TTABLE); 186 luaL_check_type(L, 1, LUA_TTABLE);
187 luaL_check_any(L, 2); 187 luaL_check_any(L, 2);
188 lua_rawget(L, -2); 188 lua_rawget(L, 1);
189 return 1; 189 return 1;
190} 190}
191 191
@@ -193,7 +193,7 @@ static int luaB_rawset (lua_State *L) {
193 luaL_check_type(L, 1, LUA_TTABLE); 193 luaL_check_type(L, 1, LUA_TTABLE);
194 luaL_check_any(L, 2); 194 luaL_check_any(L, 2);
195 luaL_check_any(L, 3); 195 luaL_check_any(L, 3);
196 lua_rawset(L, -3); 196 lua_rawset(L, 1);
197 return 1; 197 return 1;
198} 198}
199 199
@@ -449,7 +449,7 @@ static int luaB_foreachi (lua_State *L) {
449static int luaB_foreach (lua_State *L) { 449static int luaB_foreach (lua_State *L) {
450 luaL_check_type(L, 1, LUA_TTABLE); 450 luaL_check_type(L, 1, LUA_TTABLE);
451 luaL_check_type(L, 2, LUA_TFUNCTION); 451 luaL_check_type(L, 2, LUA_TFUNCTION);
452 lua_pushnil(L); /* first index */ 452 lua_pushnil(L); /* first key */
453 for (;;) { 453 for (;;) {
454 if (lua_next(L, 1) == 0) 454 if (lua_next(L, 1) == 0)
455 return 0; 455 return 0;