Ensure correct stack top for OOM error message.

Reported by Sergey Kaplun.
This commit is contained in:
Mike Pall 2022-11-09 11:01:41 +01:00
parent 46e62cd963
commit ca8d3257bb

View File

@ -488,6 +488,7 @@ LJ_NOINLINE void lj_err_mem(lua_State *L)
{
if (L->status == LUA_ERRERR+1) /* Don't touch the stack during lua_open. */
lj_vm_unwind_c(L->cframe, LUA_ERRMEM);
if (curr_funcisL(L)) L->top = curr_topL(L);
setstrV(L, L->top++, lj_err_str(L, LJ_ERR_ERRMEM));
lj_err_throw(L, LUA_ERRMEM);
}