The IntStructPtrMap and IntStructConstPtrMap sections passed newly
constructed Struct objects straight into the map and kept no Lua
reference to them. These maps store just the raw pointers, so once the
incremental collector completed a cycle the Struct objects were deleted
and the maps were left holding dangling pointers. The following value
checks then read freed memory, which sporadically failed in CI with:
li_std_map_runme.lua:68: ispmap:get(8)
Hold the Struct objects in a Lua table for the lifetime of the maps.
Confirmed as a use-after-free with valgrind and reproducible before the
fix by lowering the collector pause with collectgarbage("setpause", 105).
Assisted-by: Claude Code (Opus 5)
And move it to helpers.
Although Lua uses C floating math.
The actual used C floating functions in Lua
might be different from the actual floating functions
used in the original C code, which may lead to a slightly
different floating number.
So for calculated floating numbers we should use the cmp_flt function in the assert.
Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
- Add Lua examples
- Add and fix unused Lua tests
- Add lua_module_global complementary test of lua_no_module_global
- Add Lua test-suite runme files
Enable friends_nested and minherit inline test code for Lua via the
SWIGLUA guards.