Skip to content

Commit

Permalink
Fix possible segfault with debug library shenanigans
Browse files Browse the repository at this point in the history
local info = debug.getinfo(0)
for i=1, math.huge do
  local newInfo = debug.getinfo(i)
  if not newInfo then
    info.func()
    print("you have done little sorcery UwU")
    return
  end
  info = newInfo
end
  • Loading branch information
Sainan committed Dec 18, 2023
1 parent ed26a8a commit 8f479bc
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ static void doREPL (lua_State *L) {
*/
static int pmain (lua_State *L) {
int argc = (int)lua_tointeger(L, 1);
luaL_checktype(L, 2, LUA_TLIGHTUSERDATA); /* [Pluto] let's not deref any nullptrs if the user is being funny with the 'debug' library */
char **argv = (char **)lua_touserdata(L, 2);
int script;
int args = collectargs(argv, &script);
Expand Down

0 comments on commit 8f479bc

Please sign in to comment.