I always thought it was normal that eso crashes if I mess up my sort function in some bad way, but now that haggen had a similar problem I went to the trouble of actually reading the Lua source code and saw that it should not happen that way.
Lua Code:
local myTable = {1,2,3,4}
table.sort(myTable, function(a, b)
return true
end)
This should throw a Lua error according to the source code of
auxsort, but instead it becomes an infinite loop and hangs the process until it is killed.
I suspect it has to do with this piece here:
Code:
/* repeat ++i until a[i] >= P */
while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) {
if (i>u) luaL_error(L, "invalid order function for sorting");
lua_pop(L, 1); /* remove a[i] */
}
For some reason luaL_error does not get fired or simply does not stop code execution.