From 94b503d95ef00f1e38b58b024ef45bf8973a8746 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 10 Jun 2024 12:09:35 -0300 Subject: Encoding of table indices (hres) must use C indices As the encoding of array indices is (~index), 0 is encoded as -1 and INT_MAX is encoded as INT_MIN. --- lvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lvm.c') diff --git a/lvm.c b/lvm.c index 88f8fe27..7ee5f6bc 100644 --- a/lvm.c +++ b/lvm.c @@ -1857,7 +1857,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { luaH_resizearray(L, h, last); /* preallocate it at once */ for (; n > 0; n--) { TValue *val = s2v(ra + n); - obj2arr(h, last, val); + obj2arr(h, last - 1, val); last--; luaC_barrierback(L, obj2gco(h), val); } -- cgit v1.2.3-55-g6feb