diff options
author | phanium <91544758+phanen@users.noreply.github.com> | 2025-02-25 05:34:49 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-24 13:34:49 -0800 |
commit | 614c9322d50052c76fb3e6e1be7536a972ff0902 (patch) | |
tree | 5559e0086a7c7673cb10db7d2315806520383e0d /src | |
parent | 56fabcadb6df46c70402e4f9cd1b851856fb57e9 (diff) | |
download | rneovim-614c9322d50052c76fb3e6e1be7536a972ff0902.tar.gz rneovim-614c9322d50052c76fb3e6e1be7536a972ff0902.tar.bz2 rneovim-614c9322d50052c76fb3e6e1be7536a972ff0902.zip |
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: https://github.com/neovim/neovim/commit/a5b1b83a2693ffa7a5a0a22b3693d36ea60051be
Solution:
Check NULL before `xstrdup`.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/lua/executor.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 71c5cd4585..17009446e4 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -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 |