bug-gnulib
[Top][All Lists]
Advanced

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

Re: base64 decoding more tolerant to chars


From: Jim Meyering
Subject: Re: base64 decoding more tolerant to chars
Date: Tue, 31 Jan 2012 09:10:23 +0100

Nikos Mavrogiannopoulos wrote:
> On 01/30/2012 10:29 PM, Jim Meyering wrote:
>
>> Hi Nikos,
>> Have you considered pre-filtering the data you pass to the base64-decoding
>> function?  We considered what you're proposing when adding the
>> --ignore-garbage option to the command-line base64 program:
>
>  Could also be done, but since the code to remove newlines was there, I
> thought it is simpler to augment it to remove common garbage.

I am reluctant to make this low-level decoding function ignore anything
else.  Even for newlines, I hesitated, because an inserted newline might
represent corruption for some application, but the newline-filtering code
is mostly optional.  However, with your proposed change, an application
that previously allowed newlines, would now have to allow insertion of
arbitrarily many " \t\r" bytes as well.

Then there's the slightly higher cost of filtering out those three new
bytes in an inner loop.  If there's a noticeable performance hit, it
would not be welcome in an application that already knows or guarantees
those added bytes are not present.  This part would affect all users,
not just those that enable newline-filtering.

I think it's better if you preprocess the input.
An added benefit: if your set of ignorable bytes changes, you can
change it without worrying about gnulib's constraints.



reply via email to

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