Disallowing random garbage in base64 data

Hrvoje Niksic <[email protected]> Mon, 04 Jul 2005 15:36:12 +0200
Newsgroups gmane.emacs.xemacs.design
Message-ID <[email protected]>
Our built-in base64 decoder silently tolerates random garbage in
base64 data, based on superficial reading of section 6.8 of rfc2045.

For example, (base64-decode-string "AAAA") returns three \0
characters, but so does (base64-decode-string "AA:[]\\;;;;$#@!AA").
While allowing white space to appear anywhere in base64 stream is
clearly beneficial (I consider recode way too strict in that
department), I can't think of any benefit of allowing other garbage to
pass unchecked, and can think of problems that this behavior causes.

A longer commentary on the relevant section of rfc2045 this is
available at:

    http://www.mail-archive.com/[email protected]/msg07494.html