cmd/compile, runtime: mishandling of out of range int->string conversions
mdempsky opened this issue · 4 comments
mdempsky commented
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".
- cmd/compile rejects
string(1<<100)instead of yielding"\uFFFD": http://play.golang.org/p/1s6ge-XFqd (gccgo also rejects this; gotype accepts it.) - 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-
gopherbot commented
CL https://golang.org/cl/21344 mentions this issue.
bradfitz commented
Where is the gccgo bug?