folke / flash.nvim

Navigate your code with search labels, enhanced character motions and Treesitter integration
Apache License 2.0
2.57k stars 34 forks source link

bug: segfault on Neovim master #333

Closed famiu closed 6 months ago

famiu commented 6 months ago

Did you check docs and existing issues?

Neovim version (nvim -v)

0.10 commit 7b14eb543d43344e2498335dc93a68d200469516

Operating system/version

Fedora 40

Describe the bug

Neovim segfaults when I use any Flash motion. git-bisect on the Neovim repo points to https://github.com/neovim/neovim/commit/7b14eb543d43344e2498335dc93a68d200469516.

Log:

/home/famiu/dev/neovim/neovim/src/nvim/cursor.c:328:21: runtime error: member access within null pointer of type 'win_T' (aka 'struct window_S')
    #0 0x8bb0cd in check_cursor_lnum /home/famiu/dev/neovim/neovim/src/nvim/cursor.c:328:21
    #1 0x130754c in validate_cursor /home/famiu/dev/neovim/neovim/src/nvim/move.c:633:3
    #2 0x9cdfdc in setcursor_mayforce /home/famiu/dev/neovim/neovim/src/nvim/drawscreen.c:832:5
    #3 0x1ecd8b5 in lj_vm_ffi_call (/home/famiu/dev/neovim/neovim/build/bin/nvim+0x1ecd8b5) (BuildId: e99bcb8028809f4284ea0c40445d917270532dbb)
    #4 0x1ef3edc in lj_ccall_func /home/famiu/dev/neovim/neovim/.deps/build/src/luajit/src/lj_ccall.c:1187:5
    #5 0x1ec910c in lj_cf_ffi_meta___call /home/famiu/dev/neovim/neovim/.deps/build/src/luajit/src/lib_ffi.c:230:15
    #6 0x1ecb455 in lj_BC_FUNCC (/home/famiu/dev/neovim/neovim/build/bin/nvim+0x1ecb455) (BuildId: e99bcb8028809f4284ea0c40445d917270532dbb)
    #7 0x1eb736c in lua_pcall /home/famiu/dev/neovim/neovim/.deps/build/src/luajit/src/lj_api.c:1151:12
    #8 0x1077de1 in nlua_pcall /home/famiu/dev/neovim/neovim/src/nvim/lua/executor.c:173:16
    #9 0x107feee in nlua_call_ref /home/famiu/dev/neovim/neovim/src/nvim/lua/executor.c:1606:7
    #10 0xee829f in map_execute_lua /home/famiu/dev/neovim/neovim/src/nvim/getchar.c:3181:3
    #11 0x1398a13 in nv_colon /home/famiu/dev/neovim/neovim/src/nvim/normal.c:3176:18
    #12 0x1383bc9 in normal_execute /home/famiu/dev/neovim/neovim/src/nvim/normal.c:1229:3
    #13 0x196cbeb in state_enter /home/famiu/dev/neovim/neovim/src/nvim/state.c:101:26
    #14 0x13638e0 in normal_enter /home/famiu/dev/neovim/neovim/src/nvim/normal.c:518:3
    #15 0x10a960a in main /home/famiu/dev/neovim/neovim/src/nvim/main.c:664:3
    #16 0x7ff49b915087 in __libc_start_call_main (/lib64/libc.so.6+0x2a087) (BuildId: b098f1c75a76548bb230d8f551eae07a2aeccf06)
    #17 0x7ff49b91514a in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x2a14a) (BuildId: b098f1c75a76548bb230d8f551eae07a2aeccf06)
    #18 0x488264 in _start (/home/famiu/dev/neovim/neovim/build/bin/nvim+0x488264) (BuildId: e99bcb8028809f4284ea0c40445d917270532dbb)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/famiu/dev/neovim/neovim/src/nvim/cursor.c:328:21

Steps To Reproduce

  1. Open Neovim with flash.nvim
  2. Press f

Expected Behavior

No segfault

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  { "folke/flash.nvim", opts = {} },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
folke commented 6 months ago

Should be fixed now. Thank you for reporting!