'objsize' returns 'l_mem'

Sums of size_t may not fit in a size_t.
This commit is contained in:
Roberto Ierusalimschy
2024-11-15 12:04:53 -03:00
parent d4247befa1
commit a4762b6ffe
7 changed files with 40 additions and 25 deletions

View File

@@ -257,8 +257,9 @@ static void preinit_thread (lua_State *L, global_State *g) {
}
size_t luaE_threadsize (lua_State *L) {
size_t sz = sizeof(LX) + cast_uint(L->nci) * sizeof(CallInfo);
lu_mem luaE_threadsize (lua_State *L) {
lu_mem sz = cast(lu_mem, sizeof(LX))
+ cast_uint(L->nci) * sizeof(CallInfo);
if (L->stack.p != NULL)
sz += cast_uint(stacksize(L) + EXTRA_STACK) * sizeof(StackValue);
return sz;