Skip to content

x/tools/gopls: impossible SEGV in Scanner.next #76254

@adonovan

Description

@adonovan
#!stacks
"goPanicIndex" && "scanner.(*Scanner).next:+7"

Issue created by stacks.

Yet more blatant memory corruption:

func (s *Scanner) next() {
	if s.rdOffset < len(s.src) {
		s.offset = s.rdOffset
		...
		r, w := rune(s.src[s.rdOffset]), 1 // <--- SEGV

Weirdly though, we got two almost identical reports of this in the same day's batch.

This stack 8RmGzg was reported by telemetry:

golang.org/x/tools/gopls@v0.20.0 go1.24.6 windows/amd64 vscode (1)

Dups: xc6nww

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues 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.ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.gopls/memory-corruption"can't happen" gopls crashes (races, unsafe, miscompile, runtime bugs, faulty HW)gopls/telemetry-wins

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions