API asserts for illegal pops of to-be-closed variables

This commit is contained in:
Roberto Ierusalimschy
2024-03-11 14:05:06 -03:00
parent 7237eb3f1c
commit 65b07dd53d
5 changed files with 45 additions and 30 deletions

View File

@@ -245,6 +245,7 @@ LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) {
lua_lock(L);
name = luaG_findlocal(L, ar->i_ci, n, &pos);
if (name) {
api_checkpop(L, 1);
setobjs2s(L, pos, L->top.p - 1);
L->top.p--; /* pop value */
}