GNU bug report logs - #37992
Base64 decode should ignore CRLF

Previous Next

Package: coreutils;

Reported by: Steven Hilton <malvidin <at> gmail.com>

Date: Wed, 30 Oct 2019 14:33:02 UTC

Severity: normal

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Steven Hilton <malvidin <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: Base64 decode should ignore CRLF
Date: Wed, 30 Oct 2019 15:25:16 +0100
[Message part 1 (text/plain, inline)]
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.
[Message part 2 (text/html, inline)]

This bug report was last modified 5 years and 319 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.