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

fmt: stack overflow with recursive slice input and formatters %v/%#v #8241

Closed
gopherbot opened this issue Jun 19, 2014 · 4 comments
Closed

fmt: stack overflow with recursive slice input and formatters %v/%#v #8241

gopherbot opened this issue Jun 19, 2014 · 4 comments
Assignees
Milestone

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented Jun 19, 2014

by 2852914:

What does 'go version' print?

go version go1.3 linux/amd64

What steps reproduce the problem?

Passing a slice that contains itself to a fmt.* function with either an implicit or
explicit %v formatter will result in an infinite recursion.

http://play.golang.org/p/qjG87yG_LA

What happened?

Infinite recursion inside the printing logic, stack limit reached.

What could have happened instead?

1. The documentation for fmt mentions this recursion caveat, being obvious it could
happen this is just for clarification.
2. The fmt functions need to keep track of what it has printed and not try to print
recursive values.
3. The fmt functions keep track of what it prints and panics (or error) with a more
sensible message when it detects recursion.
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jun 19, 2014

Comment 1:

Labels changed: added repo-main, release-none.

@robpike
Copy link
Contributor

@robpike robpike commented Jul 18, 2014

Comment 2:

Let's go with option 1. It's a rare case that would add significant expense to resolve.

Labels changed: added release-go1.4, documentation, removed release-none.

Owner changed to @robpike.

Status changed to Accepted.

@gopherbot
Copy link
Author

@gopherbot gopherbot commented Sep 22, 2014

Comment 3:

CL https://golang.org/cl/144420043 mentions this issue.
@robpike
Copy link
Contributor

@robpike robpike commented Sep 22, 2014

Comment 4:

This issue was closed by revision 892b507.

Status changed to Fixed.

@rsc rsc added this to the Go1.4 milestone Apr 14, 2015
@rsc rsc removed the release-go1.4 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman added a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
wheatman added a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
wheatman added a commit to wheatman/go-akaros that referenced this issue Jul 30, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.