vinniefalco/LuaBridge

Several Undefined Behaviours and Stack Use After Scope reports when running tests

kunitoki opened this issue · 5 comments

Running the tests with ASAN and UBSAN triggers tons of reports.

See https://pastebin.com/VDygjbSv (was too big to paste here).

Interesting.

So it's MacOS.
I don't quite understand what is the issue with the 4 byte boundary.
Maybe this reason?

It's Lua which allocates memory for userdata, so actually LuaBridge has no control over the initial alignment.
Is it possible that Lua for tests is built incorrectly for MacOS?
There's a chance a correctly built Lua will not produce such alignment issues.
@kunitoki What is the Lua version (unit test app)? Do all the apps produce the same issues?

Also I can see a lot of tests are failed.
@kunitoki Are the tests failed without the ASAN?
If so, I'd say MacOS is unsupported so far.

Yes the problem is a misalignment of the memory returned by lua (newuserdata) that is used as is to do placement new luabridge classes (without taking into account class alignment), no matter which lua version you chose.

@kunitoki Are the tests failed on MacOS without the ASAN?

The tests are passing but if i will enable ASAN and UBSAN in an application using luabridge, it's annoying as it creates lot of noise when one should be interested in reports coming from the application itself.