aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/base64/base64_test.go
diff options
context:
space:
mode:
authorJosselin Costanzi <josselin@costanzi.fr>2017-03-05 18:04:30 +0100
committerIan Lance Taylor <iant@golang.org>2017-03-06 19:28:03 +0000
commit5ce06cf71d62e6fc1740d97b4ff4dda7e039c606 (patch)
tree6c0c338b6b381291f8f1a085ca09f2117e135444 /src/encoding/base64/base64_test.go
parent0efc8b21881ab35fdb45547088b1935fc8ebf263 (diff)
downloadgo-5ce06cf71d62e6fc1740d97b4ff4dda7e039c606.tar.xz
encoding/base64: fix decode reports incorrect index
Fix Decode to return the correct illegal data index from a corrupted input that contains whitespaces. Fixes #19406 Change-Id: Ib2b2b6ed7e41f024d0da2bd035caec4317c2869c Reviewed-on: https://go-review.googlesource.com/37837 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/encoding/base64/base64_test.go')
-rw-r--r--src/encoding/base64/base64_test.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/encoding/base64/base64_test.go b/src/encoding/base64/base64_test.go
index e2e1d59f3c..00b3d6171f 100644
--- a/src/encoding/base64/base64_test.go
+++ b/src/encoding/base64/base64_test.go
@@ -220,6 +220,8 @@ func TestDecodeCorrupt(t *testing.T) {
{"AAAA", -1},
{"AAAAAA=", 7},
{"YWJjZA=====", 8},
+ {"A!\n", 1},
+ {"A=\n", 1},
}
for _, tc := range testCases {
dbuf := make([]byte, StdEncoding.DecodedLen(len(tc.input)))