encoding/base64: make decoder errors independent of read chunking#80245
encoding/base64: make decoder errors independent of read chunking#80245larrasket wants to merge 1 commit into
Conversation
The stream decoder decoded each buffered chunk with a stateless call to Decode, so validity and error offsets depended on how the underlying reader happened to chunk the input. A padded group followed by more input was accepted whenever a chunk boundary fell right after the padding, even though decoding the same input as a whole rejects it, and CorruptInputError offsets were relative to the current chunk rather than the whole stream. Track how much input has been consumed and whether a padded group has been seen: reject any input that follows a padded group, and rebase error offsets so they refer to positions in the whole input stream. Fixes golang#31626
|
This PR (HEAD: a9acf71) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/796680. Important tips:
|
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/796680. |
|
Message from Gopher Robot: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be During May-July and Nov-Jan the Go project is in a code freeze, during which Please don’t reply on this GitHub thread. Visit golang.org/cl/796680. |
|
Message from Salih Gabbir: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/796680. |
The stream decoder decoded each buffered chunk with a stateless call
to Decode, so validity and error offsets depended on how the
underlying reader happened to chunk the input. A padded group followed
by more input was accepted whenever a chunk boundary fell right after
the padding, even though decoding the same input as a whole rejects
it, and CorruptInputError offsets were relative to the current chunk
rather than the whole stream.
Track how much input has been consumed and whether a padded group has
been seen: reject any input that follows a padded group, and rebase
error offsets so they refer to positions in the whole input stream.
Fixes #31626