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

strconv: Unquote inconsistently decodes invalid UTF-8 #23685

Closed
bjkail opened this issue Feb 3, 2018 · 1 comment
Closed

strconv: Unquote inconsistently decodes invalid UTF-8 #23685

bjkail opened this issue Feb 3, 2018 · 1 comment
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@bjkail
Copy link

bjkail commented Feb 3, 2018

What version of Go are you using (go version)?

Playground.

What did you do?

strconv.Unquote with a quoted string containing an invalid UTF-8 byte sequence and either an escape sequence or not: https://play.golang.org/p/VZUxFxt7gh9

What did you expect to see?

The same encoding of the invalid UTF-8 regardless of whether the string contains an escape sequence (probably a reencoding of RuneError in both cases), or documentation explaining there's a difference.

What did you see instead?

If the string does not contain an escape sequence, the invalid UTF-8 sequence is preserved.
If the string contains an escape sequence, the invalid UTF-8 sequence reencodes RuneError.

The trivial code path does not validate the UTF-8.

@bradfitz bradfitz added the NeedsFix The path to resolution is known, but the work has not been done. label Feb 4, 2018
@bradfitz bradfitz added this to the Go1.11 milestone Feb 4, 2018
@gopherbot
Copy link

Change https://golang.org/cl/92535 mentions this issue: strconv: detect invalid UTF-8 in the Unquote fast path

@golang golang locked and limited conversation to collaborators Feb 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants