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

Stefano Sabatini stefano.sabatini-lala
Sun Jan 25 00:50:21 CET 2009

On date Sunday 2009-01-25 00:29:52 +0100, Michael Niedermayer encoded:
> 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.
> Who wants and needs this where for what?
> if you cant awnser this, why would we want to implement it? just for
> implementations sake?
> maybe it is very usefull for something, i dont know but you arent telling

I don't have a strong opinion on this, the idea of the check came from
the comment which we currently have in the (not working) test program:

// these are invalid strings, that it currently decodes (which it probably shouldn't?)

The only use I can find of the patch would be for validation/testing
purposes, indeed I wrote it just for making the test program to pass
those tests.

FFmpeg = Foolish and Funny MultiPurpose Ecletic God

More information about the ffmpeg-devel mailing list