mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 13:38:34 +00:00
fix(lua): SIGSEGV in luv callback with error(nil) #32595
Problem:
luv callback `vim.uv.new_timer():start(0, 0, function() error() end)`
causes SIGSEGV, since `xstrdup` gets NULL from `lua_tostring`.
Similar to: a5b1b83a26
Solution:
Check NULL before `xstrdup`.
This commit is contained in:
@@ -221,7 +221,7 @@ static int nlua_fast_cfpcall(lua_State *lstate, int nargs, int nresult, int flag
|
||||
const char *error = lua_tostring(lstate, -1);
|
||||
|
||||
multiqueue_put(main_loop.events, nlua_luv_error_event,
|
||||
xstrdup(error), (void *)(intptr_t)kCallback);
|
||||
error != NULL ? xstrdup(error) : NULL, (void *)(intptr_t)kCallback);
|
||||
lua_pop(lstate, 1); // error message
|
||||
retval = -status;
|
||||
} else { // LUA_OK
|
||||
|
Reference in New Issue
Block a user