mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
strings: avoid utf8.RuneError mangling in Split
Split should only split strings and not perform mangling of invalid UTF-8 into ut8.RuneError. The prior behavior is clearly a bug since mangling is not performed in all other situations (e.g., separator is non-empty). Fixes #53511 Change-Id: I112a2ef15ee46ddecda015ee14bca04cd76adfbf Reviewed-on: https://go-review.googlesource.com/c/go/+/413715 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
ced4d6fd2d
commit
9a4685f220
3 changed files with 6 additions and 5 deletions
|
|
@ -755,6 +755,8 @@ var splittests = []SplitTest{
|
|||
{"123", "", 2, []string{"1", "23"}},
|
||||
{"123", "", 17, []string{"1", "2", "3"}},
|
||||
{"bT", "T", math.MaxInt / 4, []string{"b", ""}},
|
||||
{"\xff-\xff", "", -1, []string{"\xff", "-", "\xff"}},
|
||||
{"\xff-\xff", "-", -1, []string{"\xff", "\xff"}},
|
||||
}
|
||||
|
||||
func TestSplit(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue