[FFmpeg-devel] [PATCH] Make av_base64_decode() fail if the input sequence is invalid

Michael Niedermayer michaelni
Sun Jan 25 18:34:57 CET 2009


On Sat, Jan 24, 2009 at 11:18:05PM +0100, Stefano Sabatini wrote:
> Hi,
> 
> currently av_base64_decode() doesn't fail with invalid data of the
> kind "M", "M==M==", "M===".
> 
> Though I'm not sure the patch implements a good idea, maybe the
> decoder should be tolerant and accept not perfectly legal but on the
> other end meaningful inputs (for example "MQ" although not legal is
> perfectly equivalent for the decoder to "MQ=="), anyway in this case
> we cannot use the function av_base64_decode() to validate data.
> 
> An idea could be to add a flag like this:
> int av_base64_decode2(uint8_t * out, const char *in, int out_length, int validate)
> 
> but maybe this is overkill.
> 
> Opinions are welcome.

My oppinion is that you should read the RFC instead of randomly changing
code that somehow doesnt behave like you would like it to.

Quoting RFC2045
   Any characters outside of the base64 alphabet are to be ignored in
   base64-encoded data
thus your treating something else than = as error is violating the rfc

And yes this does make sense, it has something to do with portability and
the insertion of whitespace or other junk without damaging the data

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090125/a8a9ae3c/attachment.pgp>



More information about the ffmpeg-devel mailing list