Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls/internal/analysis/fillstruct: stack overflow in populateValue #71815

Open
adonovan opened this issue Feb 18, 2025 · 4 comments
Open
Labels
BugReport Issues describing a possible bug in the Go implementation. gopls/telemetry-wins gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@adonovan
Copy link
Member

#!stacks
"crash/crash" && "fillstruct.populateValue:+135"

Issue created by stacks.

func populateValue(f *ast.File, pkg *types.Package, typ types.Type) ast.Expr {
	switch u := typ.Underlying().(type) {
...	case *types.Pointer:
		switch types.Unalias(u.Elem()).(type) {
		case *types.Basic: ...
		default:
			x := populateValue(f, pkg, u.Elem())         <--- here

This stack 4zukbQ was reported by telemetry:

golang.org/x/tools/gopls@v0.17.1 go1.23.3 windows/amd64 vscode (4)
@adonovan adonovan added gopls Issues related to the Go language server, gopls. gopls/telemetry-wins NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository. labels Feb 18, 2025
@gopherbot gopherbot added this to the Unreleased milestone Feb 18, 2025
@adonovan
Copy link
Member Author

Seems like something as simple as type P *P; type S struct { p P }; var _ = S{‸} might trigger this, but that didn't work for me.

@gabyhelp gabyhelp added the BugReport Issues describing a possible bug in the Go implementation. label Feb 18, 2025
@findleyr findleyr modified the milestones: Unreleased, gopls/v0.18.1 Feb 20, 2025
@findleyr
Copy link
Member

Named types are handled separately, so this looks like either a type checker bug, or perhaps someone doing some security related testing on a huge buffer full of *s.

@findleyr findleyr modified the milestones: gopls/v0.18.1, gopls/backlog Feb 21, 2025
@findleyr
Copy link
Member

Moving this to the backlog, as absent a recurrence I suspect this is a low priority. Certainly I don't know how to make progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BugReport Issues describing a possible bug in the Go implementation. gopls/telemetry-wins gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants