Skip to content

SIGSEGV (Address boundary error) #27

@xsh005

Description

@xsh005

tldr:

local fzy = require("fzy")
fzy.filter("foo", { string.rep(" ", 1039) })
-- 1039 and below: no problem
-- 1040/1041: LuaJIT ASSERT lj_api.c:162: lua_settop: bad stack slot -2
-- fish: Job 1, 'nvim -l test.lua' terminated by signal SIGABRT (Abort)
-- 1042 and above: fish: Job 1, 'nvim -l test.lua' terminated by signal SIGSEGV (Address boundary error)
long story:

Hello! I am experimenting with this library and implementing a fuzzy finder frontend. When I was testing on a big repo, I noticed that my little script segfault-ed. I am able to narrow the problem down to one file:

My setup:

-rw-r--r--. 1 xiaoshihou xiaoshihou    205 Jan 20 16:10 fzy.lua
-rwxr-xr-x. 1 xiaoshihou xiaoshihou  29688 Jan 20 16:10 fzy_native.so
-rw-r--r--. 1 xiaoshihou xiaoshihou    337 Jan 20 16:23 test.lua
-rw-r--r--. 1 xiaoshihou xiaoshihou 158538 Jan 20 16:20 test.txt

test.txt is this file here

test.lua:

local fzy = require("fzy")
local uv = vim.uv
local path = "/tmp/test.txt"

local fd = assert(uv.fs_open(path, "r", 438))
local stat = assert(uv.fs_fstat(fd))
local data = assert(uv.fs_read(fd, stat.size, 0))
assert(uv.fs_close(fd))
data = vim.split(data, "\n") -- this outputs fine if I print it
fzy.filter("ex", data)

Then:

❯ nvim -l test.lua
fish: Job 1, 'nvim -l test.lua' terminated by signal SIGSEGV (Address boundary error)

I know there's a bunch of horrible \xc0 stuff in the file, but that shouldn't make fzy segfault 🤔
Thank you for your time!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions