[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.

Michael Niedermayer michaelni
Sat Jun 12 08:43:29 CEST 2010


On Sat, Jun 12, 2010 at 12:44:58AM +0200, Stefano Sabatini wrote:
> 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?

no, ive not tested but i suspect your patch breaks something

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

The real ebay dictionary, page 3
"Rare item" - "Common item with rare defect or maybe just a lie"
"Professional" - "'Toy' made in china, not functional except as doorstop"
"Experts will know" - "The seller hopes you are not an expert"
-------------- 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/20100612/e321a4a9/attachment.pgp>



More information about the ffmpeg-devel mailing list