Fix a stack overflow in pprint::findtables

This commit is contained in:
2022-03-29 15:58:30 -04:00
parent 3da06c8226
commit 0de1754b21

View File

@@ -62,13 +62,14 @@ static void findtables(LuaStack &LS0, LuaSlot root, LuaSlot tabcount) {
lua_pushvalue(L, root.index()); lua_pushvalue(L, root.index());
} }
while (lua_gettop(L) > top) { while (lua_gettop(L) > top) {
lua_checkstack(L, 10); lua_checkstack(L, 20);
lua_replace(L, tab.index()); lua_replace(L, tab.index());
LS.rawget(count, tabcount, tab); LS.rawget(count, tabcount, tab);
if (LS.isnil(count)) { if (LS.isnil(count)) {
LS.rawset(tabcount, tab, 0); LS.rawset(tabcount, tab, 0);
LS.set(key, LuaNil); LS.set(key, LuaNil);
while (LS.next(tab, key, val)) { while (LS.next(tab, key, val)) {
lua_checkstack(L, 20);
if (LS.istable(key)) { if (LS.istable(key)) {
lua_pushvalue(L, key.index()); lua_pushvalue(L, key.index());
} }