bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#10536: 23.3; Make base64-decode more fault tolerant


From: Lars Ingebrigtsen
Subject: bug#10536: 23.3; Make base64-decode more fault tolerant
Date: Wed, 18 Apr 2018 00:22:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Wolfram Gloger <wmglo@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





reply via email to

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