Change handling of nil value markers in template tables.

Reported by Bernhard M. Wiedemann. #1348 #1155
Fixes from Peter Cawley, Christian Clason, Lewis Russell.
This commit is contained in:
Mike Pall
2025-03-11 23:04:30 +01:00
parent 84cb21ffaf
commit 538a82133a
6 changed files with 24 additions and 25 deletions

View File

@@ -194,6 +194,7 @@ GCtab * LJ_FASTCALL lj_tab_dup(lua_State *L, const GCtab *kt)
Node *next = nextnode(kn);
/* Don't use copyTV here, since it asserts on a copy of a dead key. */
n->val = kn->val; n->key = kn->key;
if (tvistab(&n->val)) setnilV(&n->val); /* Replace nil value marker. */
setmref(n->next, next == NULL? next : (Node *)((char *)next + d));
}
}