[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: bug in auxresume (5.0 beta)??
- From: "Zimmermann, Maik" <Zimmermann@...>
- Date: Fri, 20 Dec 2002 08:21:05 +0100
Hi,
I think I have found a small bug in function auxresume in file lbaselib.c,
line 543:
static int auxresume (lua_State *L, lua_State *co, int narg) {
int status;
if (!lua_checkstack(co, narg))
luaL_error(L, "too many arguments to resume");
lua_xmove(L, co, narg);
status = lua_resume(co, narg);
if (status == 0) {
int nres = lua_gettop(co);
if (!lua_checkstack(L, narg)) /* <<< nres instead of narg? */
luaL_error(L, "too many results to resume");
lua_xmove(co, L, nres); /* move yielded values */
return nres;
}
else {
lua_xmove(co, L, 1); /* move error message */
return -1; /* error flag */
}
}
If I understand it right the marked line checks the
avaiable stackspace for the results, so it should be
...
if (!lua_checkstack(L, nres))
...
Many thanks for developing Lua to the authors.
Maik