]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Ensure correct stack top for OOM error message.
authorMike Pall <mike>
Wed, 9 Nov 2022 10:01:41 +0000 (11:01 +0100)
committerMike Pall <mike>
Wed, 9 Nov 2022 10:01:41 +0000 (11:01 +0100)
Reported by Sergey Kaplun.

src/lj_err.c

index b677b6554c463c5c7f03ef697ae3300246eb96dd..d97837220e813a05b3d1f0b4c4c1634d3ac09adc 100644 (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);
 }