summaryrefslogtreecommitdiff
path: root/src/pkg/strings
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2014-04-21 17:00:27 -0700
committerRui Ueyama <ruiu@google.com>2014-04-21 17:00:27 -0700
commitef32ad682ec7fa049e5dc375ca38d171531ee1da (patch)
treefab3eef163f24cd4ff5d97d232a1c87e06c56e33 /src/pkg/strings
parent00b64a2911274ce275318ade9209c1ef90783661 (diff)
downloadgo-ef32ad682ec7fa049e5dc375ca38d171531ee1da.tar.gz
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://codereview.appspot.com/90110043 Committer: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/pkg/strings')
-rw-r--r--src/pkg/strings/strings_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pkg/strings/strings_test.go b/src/pkg/strings/strings_test.go
index 8347818d5..95a42019a 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)