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: panic on invalid input #3442

Closed
sougou opened this issue Mar 31, 2012 · 4 comments
Closed

encoding/base64: panic on invalid input #3442

sougou opened this issue Mar 31, 2012 · 4 comments

Comments

@sougou
Copy link
Contributor

sougou commented Mar 31, 2012

Before filing a bug, please check whether it has been fixed since the
latest release. Search the issue tracker and check that you're running the
latest version of Go:

Run "go version" and compare against
http://golang.org/doc/devel/release.html  If a newer version of Go exists,
install it and retry what you did to reproduce the problem.

Thanks.

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.

http://play.golang.org/p/J8sZQQHVAH

What is the expected output?
Valid error

What do you see instead?
panic: runtime error: index out of range

goroutine 1 [running]:
encoding/base64.(*Encoding).decode(0xf840000000, 0x4d2f60, 0x0, 0xf840037003, 0x0, ...)
    go/src/pkg/encoding/base64/base64.go:257 +0x20a
encoding/base64.(*Encoding).Decode(0xf840000000, 0x4d2f60, 0x0, 0xf840037000,
0x300000003, ...)
    go/src/pkg/encoding/base64/base64.go:272 +0x77
encoding/base64.(*Encoding).DecodeString(0xf840000000, 0x48523c, 0x3d515100000003,
0xf8400250d0, 0x4242a8, ...)
    go/src/pkg/encoding/base64/base64.go:279 +0xe0
main.main()
    /tmpfs/gosandbox-76892965_1d911c88_245c62e3_2b6ea28a_24c17932/prog.go:9 +0x41

Which compiler are you using (5g, 6g, 8g, gccgo)?


Which operating system are you using?


Which version are you using?  (run 'go version')


Please provide any additional information below.
@davecheney
Copy link
Contributor

Comment 1:

Hello, 
Could you please try this CL and see if it fixes the problem.
http://golang.org/cl/5975052

@dsymonds
Copy link
Contributor

dsymonds commented Apr 3, 2012

Comment 2:

This issue was closed by revision 951a97e.

Status changed to Fixed.

@davecheney
Copy link
Contributor

Comment 3:

Issue #3517 has been merged into this issue.

@davecheney
Copy link
Contributor

Comment 4:

This issue was closed by revision e7acc6809768.

davecheney added a commit that referenced this issue May 11, 2015
… a multiple of 4

««« backport 95e67cc5fa08
encoding/base64: fix panic when input len is not a multiple of 4

Fixes #3442.

R=for.go.yong, dsymonds, sougou, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/5975052

»»»
@golang golang locked and limited conversation to collaborators Jun 24, 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