summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2022-11-09 11:01:41 +0100
committerMike Pall <mike>2022-11-09 11:01:41 +0100
commitca8d3257bb44e42100c7910c47dcdcf01f494187 (patch)
tree26c283c6f8d4c7b8592df442c8044f3395dd4826
parent46e62cd963a426e83a60f691dcbbeb742c7b3ba2 (diff)
downloadluajit2-ca8d3257bb44e42100c7910c47dcdcf01f494187.tar.gz
Ensure correct stack top for OOM error message.
Reported by Sergey Kaplun.
-rw-r--r--src/lj_err.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/lj_err.c b/src/lj_err.c
index b677b655..d9783722 100644
--- a/src/lj_err.c
+++ b/src/lj_err.c
@@ -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);
}