lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


In findloader (https://www.lua.org/source/5.3/loadlib.c.html#findloader)
luaL_buffinit is called before pushing the searchers table onto the
stack.
This breaks the "balanced stack" that luaL_buffinit is documented to expect.
Also, later code then assumes that the searchers table is at index 3.

Now, this doesn't actually manifest in a bug in PUC Rio lua 5.3, as
the implementation of luaL_buffinit doesn't touch the stack.
However if someone were to extract parts of loadlib.c to use with a
different auxlib implementation then there might be issues.

The fix is to simply move the luaL_buffinit call below the lua_getfield call.