diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-12-21 15:30:31 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-12-21 15:30:31 -0200 |
commit | 9d2e454d6f42f86faf645a4a24f66023846ea9ab (patch) | |
tree | fd77170dc472eeb7f4b9d750933ca0700d5e6ad6 | |
parent | 09e15692f3a237e2858cc67e2e7f07c3e4c983e7 (diff) | |
download | lua-9d2e454d6f42f86faf645a4a24f66023846ea9ab.tar.gz lua-9d2e454d6f42f86faf645a4a24f66023846ea9ab.tar.bz2 lua-9d2e454d6f42f86faf645a4a24f66023846ea9ab.zip |
BUG: seg. fault when rawget/rawset get extra arguments
-rw-r--r-- | bugs | 7 | ||||
-rw-r--r-- | lbaselib.c | 6 |
2 files changed, 10 insertions, 3 deletions
@@ -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 | ||
274 | Fri 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 | |||
@@ -185,7 +185,7 @@ static int luaB_globals (lua_State *L) { | |||
185 | static int luaB_rawget (lua_State *L) { | 185 | static 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) { | |||
449 | static int luaB_foreach (lua_State *L) { | 449 | static 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; |