Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoding/base64: DecodeString accepts incorrectly padded input and may produce incorrect output. #7733

Closed
gopherbot opened this issue Apr 8, 2014 · 4 comments
Milestone

Comments

@gopherbot
Copy link

by garrick@google.com:

What does 'go version' print?
go version go1.2 linux/amd64

What steps reproduce the problem?
http://play.golang.org/p/pt499XKHGk


What happened? Got 'abc' 

What should have happened instead? Want 'abcd' or an error.

Please provide any additional information below.

The following check in decode() assumes correctly padded input:

if in == '=' && j >= 2 && len(src) < 4 {
@ianlancetaylor
Copy link
Contributor

Comment 1:

Labels changed: added repo-main, release-go1.3maybe.

@bradfitz
Copy link
Contributor

Comment 2:

Well, you're ignoring the return values. If you looked at the return value, you'd see
the CorruptInputError at position 8.
But it's true that we're losing one byte of decoded output in that case.
CL on its wayl.

Owner changed to @bradfitz.

Status changed to Started.

@gopherbot
Copy link
Author

Comment 3:

CL https://golang.org/cl/88330044 mentions this issue.

@bradfitz
Copy link
Contributor

Comment 4:

This issue was closed by revision a6d3cc2.

Status changed to Fixed.

@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants