From b776bf91ff9c32a15958642967a9e7ed309be06e Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Fri, 19 Nov 2010 18:44:59 +0100 Subject: [PATCH] Tighter check on table.sort function compliance (from Lua 5.2). --- src/lib_table.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib_table.c b/src/lib_table.c index 5a1e0f78..cf39f08c 100644 --- a/src/lib_table.c +++ b/src/lib_table.c @@ -225,12 +225,12 @@ static void auxsort(lua_State *L, int l, int u) for (;;) { /* invariant: a[l..i] <= P <= a[j..u] */ /* repeat ++i until a[i] >= P */ while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) { - if (i>u) lj_err_caller(L, LJ_ERR_TABSORT); + if (i>=u) lj_err_caller(L, LJ_ERR_TABSORT); lua_pop(L, 1); /* remove a[i] */ } /* repeat --j until a[j] <= P */ while (lua_rawgeti(L, 1, --j), sort_comp(L, -3, -1)) { - if (j