Skip to content

Callbacks need to be longjmp safe #23

@daurnimator

Description

@daurnimator

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions