lua-users home
lua-l archive

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


Hi list,

I originally sent that email to an address on Luaforge but it bounced
back, so here it is (assuming lfs maintainers read that list).

While patching lfs on windows to get access to unicode filenames, I
found an unrelated bug in lfs.attributes implementation. If the second
argument of the function is a table, lfs.attributes is meant to push
the output information in that table. But it assumes that the table is
the last argument passed to the function. Specifically it calls
lua_rawset (L, -3) in the final for loop without having previously
made sure the table is on the top of the stack (with pushvalue or
settop). So if you pass additionnal parameters to lfs.attributes,
lua_rawset is then called on the last value, and if it's not a table
it can even segfault (had someone make the test with nil).

Since there are many ways to fix it I'll let the lfs authors pick one,
I guess they know Lua API enough to find one :-)

Doub.