Skip to content

x/tools/gopls: impossible nil panic in reflect.ValueOf #73853

Open
@adonovan

Description

@adonovan
#!stacks
"runtime.sigpanic" && "abi.(*Type).Kind" && "reflect.unpackEface" && "reflect.ValueOf"

Issue created by stacks.

More memory corruption:

// unpackEface converts the empty interface i to a Value.
func unpackEface(i any) Value {
	e := (*abi.EmptyInterface)(unsafe.Pointer(&i))
	// NOTE: don't read e.word until we know whether it is really a pointer or not.
	t := e.Type
	if t == nil {
		return Value{}
	}
	f := flag(t.Kind()) <-- panics because t is nil
	if t.IfaceIndir() {
		f |= flagIndir
	}
	return Value{t, e.Data, f}
}

This stack H6zSwQ was reported by telemetry:

golang.org/x/tools/gopls@v0.18.1 go1.24.3 darwin/arm64 vscode (1)

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

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions