[FFmpeg-devel] [PATCH] Make parse_primary() fails if the expression string is interpreted as a number and evaluated with av_strtod(), but only the first part of the string is parsed.
Stefano Sabatini
stefano.sabatini-lala
Sat Jun 12 00:44:58 CEST 2010
On date Thursday 2010-06-10 02:06:33 +0200, Michael Niedermayer encoded:
> On Wed, Jun 09, 2010 at 11:49:24PM +0200, Stefano Sabatini wrote:
> > ---
> > libavutil/eval.c | 22 ++++++++++++++++++++++
> > 1 files changed, 22 insertions(+), 0 deletions(-)
> >
> > diff --git a/libavutil/eval.c b/libavutil/eval.c
> > index 59ebd94..cd4ea26 100644
> > --- a/libavutil/eval.c
> > +++ b/libavutil/eval.c
> > @@ -191,6 +191,10 @@ static int parse_primary(AVExpr **e, Parser *p)
> > /* number */
> > d->value = av_strtod(p->s, &next);
> > if (next != p->s) {
> > + if (*next) {
> > + av_log(p, AV_LOG_ERROR, "Expected number but found '%s'\n", p->s);
> > + return AVERROR(EINVAL);
> > + }
> > d->type = e_value;
> > p->s= next;
> > *e = d;
> > @@ -526,6 +530,24 @@ int main(void)
> > {
> > int i;
> > double d;
> > + const char **expr, *exprs[] = {
> > + "",
> > + "foo",
> > + "1",
> > + "1foo",
> > + "foo1",
> > + "1gi",
> > + "1Gi",
>
>
> this is a quite limited set of things tested
> () + - * / sin() PI E ... should be tested too
That's not the point of the patch, I just add tests for things which
are introduced by the patch, I can also skip this hunk if you prefer
like that.
So is fine to apply?
Regards.
--
FFmpeg = Fast Fundamental Mystic Practical Exxagerate Gadget
More information about the ffmpeg-devel
mailing list