From 2f5de9ed0a7c8557cfc387ad7ff4a75679e29e7c Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sun, 4 Feb 2024 11:23:07 +0100 Subject: [PATCH] bug fix - https://github.com/lua/lua/commit/c2ea18726a466fd3c84446eb002e060c04815521 --- client/deps/liblua/lgc.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/client/deps/liblua/lgc.c b/client/deps/liblua/lgc.c index 6b407cc86..6d39bb643 100644 --- a/client/deps/liblua/lgc.c +++ b/client/deps/liblua/lgc.c @@ -490,17 +490,25 @@ static lu_mem traverseLclosure(global_State *g, LClosure *cl) { static lu_mem traversestack(global_State *g, lua_State *th) { + int n = 0; StkId o = th->stack; if (o == NULL) return 1; /* stack not completely built yet */ - for (; o < th->top; o++) + + for (; o < th->top; o++) /* mark live elements in the stack */ markvalue(g, o); + if (g->gcstate == GCSatomic) { /* final traversal? */ StkId lim = th->stack + th->stacksize; /* real end of stack */ for (; o < lim; o++) /* clear not-marked stack slice */ setnilvalue(o); + + } else { /* count call infos to compute size */ + CallInfo *ci; + for (ci = &th->base_ci; ci != th->ci; ci = ci->next) + n++; } - return sizeof(lua_State) + sizeof(TValue) * th->stacksize; + return sizeof(lua_State) + sizeof(TValue) * th->stacksize + sizeof(CallInfo) * n; }