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

unicode/utf8: decoding functions accept out-of-range input #3785

Closed
mxk opened this issue Jun 28, 2012 · 2 comments
Closed

unicode/utf8: decoding functions accept out-of-range input #3785

mxk opened this issue Jun 28, 2012 · 2 comments

Comments

@mxk
Copy link

mxk commented Jun 28, 2012

In reference to: http://groups.google.com/d/topic/golang-nuts/-vRM1B4z8bk/discussion

What steps will reproduce the problem?
Use utf8.DecodeRune or related functions to decode a 4-byte UTF-8 sequence, which
encodes a code point greater than utf8.MaxRune (U+10FFFF):

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

What is the expected output?
Each byte of the input should be treated as invalid, so utf8.DecodeRune(b[i:]) should
return (RuneError, 1) four times. This is what happens for a 5-byte input, such as
"\xFB\xBF\xBF\xBF\xBF" (U+3FFFFFF).

What do you see instead?
The input is decoded as U+1FFFFF, which is correct, but is not a valid code point.

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Windows 7 64-bit

Which version are you using?  (run 'go version')
go version go1.0.2
@minux
Copy link
Member

minux commented Jun 30, 2012

Comment 1:

Labels changed: added priority-soon, removed priority-triage.

Owner changed to @minux.

Status changed to Accepted.

@robpike
Copy link
Contributor

robpike commented Jul 19, 2012

Comment 2:

This issue was closed by revision fc360f2.

Status changed to Fixed.

@mxk mxk added fixed labels Jul 19, 2012
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
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