diff options
author | Rui Ueyama <ruiu@google.com> | 2014-04-21 17:00:27 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2014-04-21 17:00:27 -0700 |
commit | 7ff8e90eb7ceb2016aa9fc736febd8a5902ec65e (patch) | |
tree | e5a384568d92c7959f0f328c4a93edc673407d27 | |
parent | 2653386ce8dfd497fb9b8f65bc75ef9adf8e7b58 (diff) | |
download | go-7ff8e90eb7ceb2016aa9fc736febd8a5902ec65e.tar.gz go-7ff8e90eb7ceb2016aa9fc736febd8a5902ec65e.zip |
strings: fix off-by-one error in testgo1.3beta1
Previously it would panic because of out-of-bound access
if s1 is longer than s2.
LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/90110043
-rw-r--r-- | src/pkg/strings/strings_test.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pkg/strings/strings_test.go b/src/pkg/strings/strings_test.go index 8347818d59..95a42019a3 100644 --- a/src/pkg/strings/strings_test.go +++ b/src/pkg/strings/strings_test.go @@ -652,7 +652,7 @@ func equal(m string, s1, s2 string, t *testing.T) bool { e1 := Split(s1, "") e2 := Split(s2, "") for i, c1 := range e1 { - if i > len(e2) { + if i >= len(e2) { break } r1, _ := utf8.DecodeRuneInString(c1) |