Callback functions (on_connect, on_message, etc.) are called from non-lua code; which I cannot see as documented to be longjmp safe.
Lua C api functions will longjmp out on failure to the last pcall.
To fix, your lua function invocations should use lua_pcall.
Additionally, other functions such as lua_pushstring can longjmp out on memory allocation failure.
|
lua_pushstring(ctx->L, str); |
These should also be called from inside a pcall (push a pointer on the stack instead and then inside the pcall use lua_pushstring).
Callback functions (
on_connect,on_message, etc.) are called from non-lua code; which I cannot see as documented to belongjmpsafe.Lua C api functions will longjmp out on failure to the last
pcall.To fix, your lua function invocations should use
lua_pcall.Additionally, other functions such as
lua_pushstringcan longjmp out on memory allocation failure.lua-mosquitto/lua-mosquitto.c
Line 555 in aa2e0b7
These should also be called from inside a pcall (push a pointer on the stack instead and then inside the pcall use
lua_pushstring).