Guard against most egregious mistakes in calling the library

LuaJIT FFI is not inherently memory safe and there is no way
to completely guard against the caller doing something that
will trample over memory, but we can get pretty close. Biggest
issue is that an empty table will stand-in for a ref struct with
a null ref. So check for that in all the calls. In the calls that
raise errors we now have a specific error for it. In the other
functions the "nil" object is handled quietly but without a nullptr
dereference and hopefully no UB.
This commit is contained in:
2024-02-12 22:03:45 -06:00
parent 59bdeedc18
commit e43272487f
8 changed files with 428 additions and 273 deletions

View File

@@ -8,5 +8,6 @@
"lua_modules/share/lua/5.1/?.lua",
"lua_modules/share/lua/5.1/?/init.lua"
],
"workspace.library": ["${3rd}/busted/library", "${3rd}/luassert/library"],
"workspace.checkThirdParty": false
}