Closed
Description
This stack 5wndWg
was reported by telemetry:
func fromValueSpec(fset *token.FileSet, ti *types.Info, vs *ast.ValueSpec, pos token.Pos) *StubInfo {
var idx int
for i, vs := range vs.Values {
if pos >= vs.Pos() && pos <= vs.End() {
idx = i
break
}
}
valueNode := vs.Values[idx] // <-- the crash implies that idx == len(vs.Values) == 0
gopls/bug
golang.org/x/tools/gopls/internal/bug.report:35
golang.org/x/tools/gopls/internal/bug.Errorf:2
golang.org/x/tools/gopls/internal/lsp.(*Server).codeAction.func1.1:2
runtime.gopanic:88
runtime.goPanicIndex:2
golang.org/x/tools/gopls/internal/lsp/analysis/stubmethods.fromValueSpec:9
golang.org/x/tools/gopls/internal/lsp/analysis/stubmethods.GetStubInfo:4
golang.org/x/tools/gopls/internal/lsp/analysis/stubmethods.DiagnosticForError:6
golang.org/x/tools/gopls/internal/lsp.(*Server).codeAction.func1:11
golang.org/x/tools/gopls/internal/lsp.(*Server).codeAction:210
golang.org/x/tools/gopls/internal/lsp.(*Server).CodeAction:1
golang.org/x/tools/gopls/internal/lsp/protocol.serverDispatch:142
golang.org/x/tools/gopls/internal/lsp/lsprpc.(*StreamServer).ServeStream.ServerHandler.func3:5
golang.org/x/tools/gopls/internal/lsp/lsprpc.(*StreamServer).ServeStream.handshaker.func4:52
golang.org/x/tools/gopls/internal/lsp/protocol.Handlers.MustReplyHandler.func1:2
golang.org/x/tools/gopls/internal/lsp/protocol.Handlers.AsyncHandler.func2.2:3
golang.org/x/tools/gopls@v0.14.2 go1.21.2 darwin/arm64 (1)
This OOB index looks very similar (but not the same) as a recent bug in StubMethods: #64087.
Issue created by golang.org/x/tools/gopls/internal/telemetry/cmd/stacks.
Dups:
This stack KFS4Ow
was reported by telemetry:
gopls/bug
golang.org/x/tools/gopls/internal/bug.report:35
golang.org/x/tools/gopls/internal/bug.Errorf:2
golang.org/x/tools/gopls/internal/lsp.(*Server).codeAction.func1.1:2
runtime.gopanic:50
runtime.goPanicIndex:2
golang.org/x/tools/gopls/internal/lsp/analysis/stubmethods.fromValueSpec:9
golang.org/x/tools/gopls/internal/lsp/analysis/stubmethods.GetStubInfo:4
golang.org/x/tools/gopls/internal/lsp/analysis/stubmethods.DiagnosticForError:6
golang.org/x/tools/gopls/internal/lsp.(*Server).codeAction.func1:11
golang.org/x/tools/gopls/internal/lsp.(*Server).codeAction:210
golang.org/x/tools/gopls/internal/lsp.(*Server).CodeAction:1
golang.org/x/tools/gopls/internal/lsp/protocol.serverDispatch:142
golang.org/x/tools/gopls/internal/lsp/lsprpc.(*StreamServer).ServeStream.ServerHandler.func3:5
golang.org/x/tools/gopls/internal/lsp/lsprpc.(*StreamServer).ServeStream.handshaker.func4:52
golang.org/x/tools/gopls/internal/lsp/protocol.Handlers.MustReplyHandler.func1:2
golang.org/x/tools/gopls/internal/lsp/protocol.Handlers.AsyncHandler.func2.2:3
golang.org/x/tools/gopls@v0.14.2 go1.22.0 darwin/arm64 vscode (1)
Issue created by golang.org/x/tools/gopls/internal/telemetry/cmd/stacks.
Metadata
Metadata
Assignees
Labels
Type
Projects
Relationships
Development
No branches or pull requests
Activity
gopherbot commentedon Dec 11, 2023
Change https://go.dev/cl/548737 mentions this issue:
gopls/internal/analysis/stubmethods: fix OOB panic in fromValueSpec
gopls/internal/analysis/stubmethods: fix OOB panic in fromValueSpec