encoding/base32, encoding/base64: fix issues with decoder whitespace handling
Adds a new reader to filter newlines, which fixes errors seen in the
decoder chunking code. Found additional issues with whitespace handling
after the first padding character.
Fixes issue 4779.
https://codereview.appspot.com/7311069/diff/2002/src/pkg/encoding/base64/base64.go File src/pkg/encoding/base64/base64.go (right): https://codereview.appspot.com/7311069/diff/2002/src/pkg/encoding/base64/base64.go#newcode227 src/pkg/encoding/base64/base64.go:227: // Ignore this character. seems this if is of ...
11 years, 2 months ago
(2013-02-10 20:40:29 UTC)
#2
11 years, 2 months ago
(2013-02-14 20:01:25 UTC)
#7
https://codereview.appspot.com/7311069/diff/5/src/pkg/encoding/base64/base64.go
File src/pkg/encoding/base64/base64.go (right):
https://codereview.appspot.com/7311069/diff/5/src/pkg/encoding/base64/base64....
src/pkg/encoding/base64/base64.go:233: nonWsIdx := bytes.IndexFunc(src, func(r
rune) bool {
On 2013/02/14 19:20:17, rsc wrote:
> Why is this necessary if the newlineFilteringReader is already stripping \r
and
> \n?
newlineFilteringReader is only currently used in NewDecoder(*Encoding,
io.Reader). There are other entry points into this function (Decode(dst, src
[]byte) and DecodeString(s string)) which call this method directly. If
preferred, I could wrap the parameters passed to those methods with a
newlineFilteringReader and remove all of this logic to ensure the only entry
points into this function have already removed all whitespace.
My original goal was to fix the reported issue with using a Reader, but after
closer inspection I found additional errors in the whitespace handling in
decode().
*** Submitted as https://code.google.com/p/go/source/detail?r=15d86e64b42e *** encoding/base32, encoding/base64: fix issues with decoder whitespace handling Adds a ...
11 years, 1 month ago
(2013-03-12 05:50:14 UTC)
#15
*** Submitted as https://code.google.com/p/go/source/detail?r=15d86e64b42e ***
encoding/base32, encoding/base64: fix issues with decoder whitespace handling
Adds a new reader to filter newlines, which fixes errors seen in the
decoder chunking code. Found additional issues with whitespace handling
after the first padding character.
Fixes issue 4779.
R=minux.ma, rsc, bradfitz
CC=golang-dev
https://codereview.appspot.com/7311069
Committer: Russ Cox <rsc@golang.org>
Issue 7311069: code review 7311069: encoding/base32, encoding/base64: fix issues with decod...
(Closed)
Created 11 years, 2 months ago by pkwarren
Modified 11 years, 1 month ago
Reviewers:
Base URL:
Comments: 7