[FFmpeg-devel] [PATCH] Fix yet another av_set_string() bug

Stefano Sabatini stefano.sabatini-lala
Wed May 14 15:56:04 CEST 2008


On date Wednesday 2008-05-14 14:59:50 +0200, Michael Niedermayer encoded:
> On Wed, May 14, 2008 at 02:45:24PM +0200, Stefano Sabatini wrote:
> > On date Wednesday 2008-05-14 13:13:12 +0200, Michael Niedermayer encoded:
> > > On Wed, May 14, 2008 at 01:03:40PM +0200, Stefano Sabatini wrote:
> > > > Hi all,
> > > > 
> > > > when the av_set_number() is called with a parsable yet not valid
> > > > (e.g. out of range) value then av_set_string() should return NULL.
> > > > 
> > > > Check the bug for example with:
> > > > ffmpeg -bt -1000
> > > > 
> > > > Regards.
> > > > -- 
> > > > FFmpeg = Fiendish and Fast MultiPurpose EnGine
> > > 
> > > > Index: libavcodec/opt.c
> > > > ===================================================================
> > > > --- libavcodec/opt.c	(revision 13153)
> > > > +++ libavcodec/opt.c	(working copy)
> > > > @@ -182,9 +182,9 @@
> > > >              }else if(cmd=='-')
> > > >                  d= -d;
> > > >  
> > > > -            av_set_number(obj, name, d, 1, 1);
> > > > +            o= av_set_number(obj, name, d, 1, 1);
> > > >              val+= i;
> > > > -            if(!*val)
> > > > +            if(!*val || !o)
> > > >                  return o;
> > > 
> > > rejected, you misuse o as a temporary variable
> > 
> > OK, check this one.
> 
> What about printing an appropriate error message?

I think av_set_number() already prints an appropriate error message (the
only possible one which is out of range value).

For example:

stefano at geppetto ~/s/ffmpeg> ffmpeg -bt -1
[...]
Value -1.000000 for parameter 'bt' out of range.
Value -1.000000 for parameter 'bt' out of range.
Value -1.000000 for parameter 'bt' out of range.
ffmpeg: unrecognized option '-bt'

BTW what about the make such messages more useful, for example
(similar to what set_number_or_die already does):
The value for bt was -1 which is not within 1.000000 - inf
?

Regards.
-- 
FFmpeg = Frenzy Furious MultiPurpose EnGraver




More information about the ffmpeg-devel mailing list