aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/base32/base32.go
diff options
context:
space:
mode:
authorteivah <t.harsanyi@thebeat.co>2022-05-03 09:54:48 +0000
committerGopher Robot <gobot@golang.org>2022-05-03 18:30:15 +0000
commit8a5845e4e34c046758af3729acf9221b8b6c01ae (patch)
tree2782684e39238f6040cf89bae835a008e7ff348b /src/encoding/base32/base32.go
parent35d02791b990082fe80da54352050bd095ebd1e7 (diff)
downloadgo-8a5845e4e34c046758af3729acf9221b8b6c01ae.tar.xz
encoding/base32: decoder output depends on chunking of underlying reader
After an analysis, I figured that a way to do it could be to check, after the call to readEncodedData whether the decoder already saw the end or not. Fixes #38657 Change-Id: I06fd718ea4ee6ded2cb26c2866b28581ad86e271 GitHub-Last-Rev: d0b7bb38e4301a2ae9b8e588944488dbd88b39c4 GitHub-Pull-Request: golang/go#52631 Reviewed-on: https://go-review.googlesource.com/c/go/+/403315 Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/encoding/base32/base32.go')
-rw-r--r--src/encoding/base32/base32.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/encoding/base32/base32.go b/src/encoding/base32/base32.go
index 5f3af4c8bb..fa6e42e26c 100644
--- a/src/encoding/base32/base32.go
+++ b/src/encoding/base32/base32.go
@@ -445,6 +445,9 @@ func (d *decoder) Read(p []byte) (n int, err error) {
if d.nbuf < min {
return 0, d.err
}
+ if nn > 0 && d.end {
+ return 0, CorruptInputError(0)
+ }
// Decode chunk into p, or d.out and then p if p is too small.
var nr int