GNU bug report logs -
#10536
23.3; Make base64-decode more fault tolerant
Previous Next
Full log
Message #12 received at 10536 <at> debbugs.gnu.org (full text, mbox):
Wolfram Gloger <wmglo <at> dent.med.uni-muenchen.de> writes:
> Not a bug in Emacs, but I have received base64-encoded mails from a
> not-so-small company which could not be decoded. It turns out that
> there was a missing padding character, i.e. the last quartet was
> "xy=" rather than the proper "xy==".
>
> I would suggest that base64-decode should tolerate this, like with
> the appended patch.
>
> Regards,
> Wolfram.
>
> --- src/fns.c~ 2011-04-05 05:46:44.000000000 +0200
> +++ src/fns.c 2012-01-17 13:59:26.000000000 +0100
> @@ -3590,7 +3590,8 @@
>
> if (c == '=')
> {
> - READ_QUADRUPLET_BYTE (-1);
> + /* Be tolerant against missing final padding '='. */
> + READ_QUADRUPLET_BYTE (e-to);
It probably won't harm anything to add this patch... On the other hand,
it's not very common to have base64 encoded data that fails in this
manner.
What do the rest of you people think? (I think I'm slightly for
applying the patch. "Be liberal in what you receive" and all that.)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 6 years and 22 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.