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

cmd/compile, runtime: mishandling of out of range int->string conversions #15039

Closed
mdempsky opened this issue Mar 31, 2016 · 4 comments
Closed

Comments

@mdempsky
Copy link
Member

Go spec says:

Converting a signed or unsigned integer value to a string type yields a string containing the UTF-8 representation of the integer. Values outside the range of valid Unicode code points are converted to "\uFFFD".

  1. cmd/compile rejects string(1<<100) instead of yielding "\uFFFD": http://play.golang.org/p/1s6ge-XFqd (gccgo also rejects this; gotype accepts it.)
  2. runtime incorrectly truncates 64-bit integer values to uint32 before checking if they're a valid Unicode code point: http://play.golang.org/p/M_Gkll5VY-
@mdempsky mdempsky self-assigned this Mar 31, 2016
@gopherbot
Copy link

CL https://golang.org/cl/21344 mentions this issue.

@bradfitz
Copy link
Contributor

Where is the gccgo bug?

@mdempsky
Copy link
Member Author

Filed #15041 for gccgo.

@griesemer
Copy link
Contributor

This was a duplicate of #11330 which it fixed as well.

@golang golang locked and limited conversation to collaborators Aug 24, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants