From 9ce7a7ed9818208791041a29e6653e16b81d8604 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Sun, 19 Mar 2023 20:39:33 +0000 Subject: fix stack underflow causing segfault on luajit --- lmdb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lmdb.c b/lmdb.c index 41bb2cf..f81d555 100644 --- a/lmdb.c +++ b/lmdb.c @@ -391,8 +391,9 @@ static void mt(lua_State *L, const char *name, const struct luaL_Reg l[]) { if (lua_isnil(L, -1)){ lua_pop(L, 1); lua_setfield(L, -1, "__index"); + } else { + lua_pop(L, 2); } - lua_pop(L, 2); } static void parentmap(lua_State *L) { -- cgit v1.2.3