bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#37992: Base64 decode should ignore CRLF


From: Steven Hilton
Subject: bug#37992: Base64 decode should ignore CRLF
Date: Wed, 30 Oct 2019 15:25:16 +0100

I believe that the base64 implementation in coreutils should ignore
carriage return and line feed line endings (CR, LF, CRLF). Currently, it
only ignores LF line endings.
The -i/--ignore-garbage flag is effective, but should not fail on common
line endings.

$ echo -ne
"R05VIEJhc2U2NCBkZWNvZGUgc2hvdWxkIGlnbm9yZSBib3RoIENSIGFuZC9vciBMRg0K\r\nR05VIEJhc2U2NCBkZWNvZGUgc2hvdWxkIGlnbm9yZSBib3RoIENSIGFuZC9vciBMRg0K"
| base64 -d
Current Output:
GNU Base64 decode should ignore both CR and/or LF
base64: invalid input

Expected Output:
GNU Base64 decode should ignore both CR and/or LF
GNU Base64 decode should ignore both CR and/or LF

Per the Base64 RFC, section 3.3,

Note that this means that any adjacent carriage return/line feed
(CRLF) characters constitute "non-alphabet characters" and are
ignored.

https://tools.ietf.org/html/rfc4648#section-3.3
<https://www.google.com/url?q=https://tools.ietf.org/html/rfc4648%23section-3.3&sa=D&source=hangouts&ust=1572513581650000&usg=AFQjCNGmIlJSlyucb75tnWNUbAovfdasIg>

My interpretation of this section is that the base64 decoding should either
fail on any non-Alphabet character, or should ignore any line ending
combination.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]