From 38cc7d40a4bcb89314d212fdffd2ca8deebc3cb7 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 15 Feb 2021 10:38:09 -0300 Subject: Bug: cannot allow the call 'debug.getinfo(0, ">")' A 'what' argument starting with '>' indicates that there is a function in the C stack, which won't be there if the first argument is not a function. --- ldblib.c | 1 + 1 file changed, 1 insertion(+) (limited to 'ldblib.c') diff --git a/ldblib.c b/ldblib.c index 15593bfb..de6e38b3 100644 --- a/ldblib.c +++ b/ldblib.c @@ -152,6 +152,7 @@ static int db_getinfo (lua_State *L) { lua_State *L1 = getthread(L, &arg); const char *options = luaL_optstring(L, arg+2, "flnSrtu"); checkstack(L, L1, 3); + luaL_argcheck(L, options[0] != '>', arg + 2, "invalid option '>'"); if (lua_isfunction(L, arg + 1)) { /* info about a function? */ options = lua_pushfstring(L, ">%s", options); /* add '>' to 'options' */ lua_pushvalue(L, arg + 1); /* move function to 'L1' stack */ -- cgit v1.2.3-55-g6feb