-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.Issues related to the Go language server, gopls.gopls/telemetry-wins
Milestone
Description
#!stacks
"goPanicSliceB" && "completion.Selection.Suffix" && "toProtocolCompletionItems"
Issue created by stacks.
func (p Selection) PrefixRange() (protocol.Range, error) {
return p.mapper.PosRange(p.tokFile, p.start, p.cursor)
}
func (p Selection) Prefix() string {
return p.content[:p.cursor-p.start]
}
func (p Selection) Suffix() string {
return p.content[p.cursor-p.start:] // <--- out of bounds panic, after a successful call to PrefixRange
}panicSliceB indicates failure of the p.cursor-p.start <= len(p.content) assertion.
This stack BigXFw was reported by telemetry:
crash/crashruntime.gopanic:+69runtime.goPanicSliceB:+2golang.org/x/tools/gopls/internal/golang/completion.Selection.Suffix:=367golang.org/x/tools/gopls/internal/server.toProtocolCompletionItems:+9golang.org/x/tools/gopls/internal/server.(*server).Completion:+52golang.org/x/tools/gopls/internal/protocol.serverDispatch:+193golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3:+5golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4:+52golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1:+2golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2:+3runtime.goexit:+0
golang.org/x/tools/gopls@v0.16.0 go1.23.12 darwin/amd64 gopls.client=vscode (5)
Use this command to reproduce the executable:
(HOME=$(mktemp -d); GOOS=darwin GOARCH=amd64 GOTOOLCHAIN=go1.23.12 go install golang.org/x/tools/gopls@v0.16.0 && find $HOME/go/bin -type f)
To disassemble: go tool objdump exe | less
Metadata
Metadata
Assignees
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.Issues related to the Go language server, gopls.gopls/telemetry-wins