commit 6bfef60e77f5eec1057470010b4179ee6f830fe6
parent 370d31a5593220723d222dec6e3e4019decc3309
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Fri, 11 Mar 2005 12:50:46 -0300
bug: rawset/rawget do not ignore extra arguments
Diffstat:
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/bugs b/bugs
@@ -743,3 +743,24 @@ patch = [[
]],
}
+
+Bug{
+what = [[rawset/rawget do not ignore extra arguments]],
+
+report = [[Romulo Bahiense, 11/03/2005]],
+
+example = [[
+a = {}
+rawset(a, 1, 2, 3)
+print(a[1], a[2]) -- should be 2 and nil
+]],
+
+patch = [[
+* lbaselib.c:
+175a176
+> lua_settop(L, 2);
+183a185
+> lua_settop(L, 3);
+]],
+}
+
diff --git a/lbaselib.c b/lbaselib.c
@@ -1,5 +1,5 @@
/*
-** $Id: lbaselib.c,v 1.168 2005/02/23 17:30:22 roberto Exp roberto $
+** $Id: lbaselib.c,v 1.169 2005/02/28 17:24:41 roberto Exp roberto $
** Basic library
** See Copyright Notice in lua.h
*/
@@ -164,6 +164,7 @@ static int luaB_rawequal (lua_State *L) {
static int luaB_rawget (lua_State *L) {
luaL_checktype(L, 1, LUA_TTABLE);
luaL_checkany(L, 2);
+ lua_settop(L, 2);
lua_rawget(L, 1);
return 1;
}
@@ -172,6 +173,7 @@ static int luaB_rawset (lua_State *L) {
luaL_checktype(L, 1, LUA_TTABLE);
luaL_checkany(L, 2);
luaL_checkany(L, 3);
+ lua_settop(L, 3);
lua_rawset(L, 1);
return 1;
}