From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marc Horowitz Newsgroups: gmane.emacs.bugs Subject: base64 behavior is not MIME compliant Date: Sat, 02 Jul 2005 19:19:32 -0400 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1120346957 28996 80.91.229.2 (2 Jul 2005 23:29:17 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 2 Jul 2005 23:29:17 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 03 01:29:14 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DorPj-00033V-47 for geb-bug-gnu-emacs@m.gmane.org; Sun, 03 Jul 2005 01:28:47 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DorQr-0002Aa-0v for geb-bug-gnu-emacs@m.gmane.org; Sat, 02 Jul 2005 19:29:57 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DorP0-0001eR-EZ for bug-gnu-emacs@gnu.org; Sat, 02 Jul 2005 19:28:02 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DorOu-0001ay-B4 for bug-gnu-emacs@gnu.org; Sat, 02 Jul 2005 19:27:58 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DorOs-0001Xh-2d for bug-gnu-emacs@gnu.org; Sat, 02 Jul 2005 19:27:54 -0400 Original-Received: from [69.25.196.71] (helo=central-air-conditioning.toybox.cambridge.ma.us) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DorMD-0006h6-R6 for bug-gnu-emacs@gnu.org; Sat, 02 Jul 2005 19:25:09 -0400 Original-Received: by central-air-conditioning.toybox.cambridge.ma.us (Postfix, from userid 8888) id 5931A3C0C8; Sat, 2 Jul 2005 19:19:32 -0400 (EDT) Original-To: bug-gnu-emacs@gnu.org, bugs@gnus.org User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:12395 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:12395 (emacs-version) "GNU Emacs 21.4.1 (i386-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2005-03-17 on trouble, modified by Debian" (gnus-version) "No Gnus v0.4" RFC 3548 has this to say about characters not part of the encoding alphabet: Implementations MUST reject the encoding if it contains characters outside the base alphabet when interpreting base encoded data, unless the specification referring to this document explicitly states otherwise. Such specifications may, as MIME does, instead state that characters outside the base encoding alphabet should simply be ignored when interpreting data ("be liberal in what you accept"). The second sentence is a reference to RFC 2045: Any characters outside of the base64 alphabet are to be ignored in base64-encoded data. The base64-decode-region function is somewhere in the middle, and therefore compliant with neither spec: in addition to the alphabet characters, it seems to accept whitespace, but nothing else. Gnus's mm-decode-content-transfer-encoding method, in mm-bodies.el, both in No Gnus and in the verison shipped with emacs 21.4, uses base64-decode-region, which means it does not conform to the MIME standard. I believe the best fix is for base64-decode-region to take an optional argument which specifies how liberal it should be about it's input, defaulting to the current behavior, and for Gnus to use this argument. It should, at the least, provide modes for strict parsing (no extra chars or whitespace), the current behavior (accept whitespace), and the MIME-compliant behavior (ignore all extra chars). Of course, Gnus can fix this independently by using an external base64 implementation which is MIME-compliant. Marc