zls icon indicating copy to clipboard operation
zls copied to clipboard

Index out of bounds panic

Open kcbanner opened this issue 3 years ago • 3 comments

thread 16548 panic: index out of bounds
C:\cygwin64\home\kcbanner\kit\zls\src\analysis.zig:1624:5: 0x7ff7a03eaec7 in analysis.documentPositionContext (zls.obj)
    return block: {
    ^
C:\cygwin64\home\kcbanner\kit\zls\src\main.zig:1719:53: 0x7ff7a03b35c8 in processJsonRpc (zls.obj)
                    done = extractErr(method_info[2](arena, id, request_obj, config));
                                                    ^
C:\cygwin64\home\kcbanner\kit\zls\src\main.zig:1962:27: 0x7ff7a037e94a in main (zls.obj)
        try processJsonRpc(&arena, &json_parser, buf, config);
                          ^
E:\dev\zig-windows-x86_64-0.9.0-dev.315+1534cd2f8\lib\zig\std\start.zig:256:65: 0x7ff7a03765d1 in std.start.WinStartup (zls.obj)
    std.os.windows.kernel32.ExitProcess(initEventLoopAndCallMain());
                                                                ^
Unable to dump stack trace: FileNotFound

I think this may be related to having an @import that results in a file not found, will update with more info if I find a more specific repro.

kcbanner avatar Aug 08 '21 17:08 kcbanner

what was the code that caused this to happen?

nektro avatar Sep 30 '21 03:09 nektro

Also ran into this problem (or a similar problem). Here is a repo which reliably crashes ZLS for me on Windows (haven't tested on other systems): https://github.com/obiwanus/zls-crash-test

In the readme there are instructions on how to reproduce the crash.

obiwanus avatar Jan 14 '22 23:01 obiwanus

I forgot to add that I tested it in VSCode

obiwanus avatar Jan 15 '22 01:01 obiwanus

The provided reproduction no longer crashes with latest zls (after making the necessary changes to get zig build -h to work with latest zig).

leecannon avatar Oct 10 '22 22:10 leecannon