]> Cypherpunks repositories - gostls13.git/commit
encoding/base32: ensure base32 decoder propagates errors correctly
authorMark Ryan <mark.d.ryan@intel.com>
Sat, 29 Apr 2017 05:19:18 +0000 (06:19 +0100)
committerBrad Fitzpatrick <bradfitz@golang.org>
Thu, 18 May 2017 22:37:49 +0000 (22:37 +0000)
commit1ea796ee69a495e51abba01711f4aca0beeb6bed
treeeead17d8ba277c7f706f5a66729e9142d540e843
parent26a852112d1c0505846fa3efbc1060a4dbdd7ae5
encoding/base32: ensure base32 decoder propagates errors correctly

A number of issues in decoder.Read and newlineFilteringReader.Read were
preventing errors from the reader supplying the encoded data from being
propagated to the caller.  Fixing these issues revealed some additional
problems in which valid decoded data was not always returned to the user
when errors were actually propagated.

This commit fixes both the error propagation and the lost decoded data
problems.  It also adds some new unit tests to ensure errors are handled
correctly by decoder.Read.  The new unit tests increase the test coverage
of this package from 96.2% to 97.9%.

Fixes #20044

Change-Id: I1a8632da20135906e2d191c2a8825b10e7ecc4c5
Reviewed-on: https://go-review.googlesource.com/42094
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/encoding/base32/base32.go
src/encoding/base32/base32_test.go