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: ignore \r \n during decode #2541

Closed
gopherbot opened this issue Dec 8, 2011 · 10 comments
Closed

encoding/base64: ignore \r \n during decode #2541

gopherbot opened this issue Dec 8, 2011 · 10 comments
Milestone

Comments

@gopherbot
Copy link
Contributor

by jason.swank:

The base64 package does not decode base64 encoded content with newlines, as is typical
w/ email attachments and most base64 implementations every 76 characters.

The Mime RFC (2045) section 6.8 specifies all non-alphanumeric characters must be
ignored by a compliant decoder, but warnings/errors might be appropriate under some
circumstances.

Attached is a small go base64 program- base64.go.  Using it along w/ the system's base64
command, it is easy to reproduce the issue:

1) WORKS, no newlines: 
   $ echo -n "Hello, World" | base64 -w 0 | ./base64-go
   Hello, World

2) BROKEN, newlines every 12 characters:
   $ echo -n "Hello, World" | base64 -w 12 | ./base64-go
   Hello, Wo
   illegal base64 data at input byte 12

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

Which operating system are you using? Linux i686

Which revision are you using?  0beb796b4ef8+ weekly/weekly.2011-12-02

Please provide any additional information below.

Attachments:

  1. base64-go.go (407 bytes)
@rsc
Copy link
Contributor

rsc commented Dec 9, 2011

Comment 1:

Labels changed: added priority-later, removed priority-medium.

@rsc
Copy link
Contributor

rsc commented Dec 12, 2011

Comment 2:

Labels changed: added priority-go1.

@robpike
Copy link
Contributor

robpike commented Dec 12, 2011

Comment 3:

Owner changed to @robpike.

Status changed to Accepted.

@robpike
Copy link
Contributor

robpike commented Dec 20, 2011

Comment 4:

assigning to brad, cc to adam. i honestly do not understand what the correct behavior
should be. encoding is particularly unclear.

Owner changed to @bradfitz.

@agl
Copy link
Contributor

agl commented Dec 20, 2011

Comment 5:

FWIW, I think I agree that newlines should be ignored in decoding - they certainly are
in Python. I'll fix this unless someone beats me to it.

@robpike
Copy link
Contributor

robpike commented Jan 13, 2012

Comment 6:

Owner changed to builder@golang.org.

@rsc
Copy link
Contributor

rsc commented Jan 30, 2012

Comment 8:

Labels changed: added go1-must.

@dsymonds
Copy link
Contributor

dsymonds commented Feb 1, 2012

Comment 9:

Owner changed to @dsymonds.

@dsymonds
Copy link
Contributor

dsymonds commented Feb 1, 2012

Comment 10:

Status changed to Started.

@dsymonds
Copy link
Contributor

dsymonds commented Feb 1, 2012

Comment 11:

This issue was closed by revision 2f2b6e5.

Status changed to Fixed.

@rsc rsc added this to the Go1 milestone Apr 10, 2015
@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

5 participants