[FFmpeg-devel] [PATCH 3/6] Make av_parse_expr() fail if there are trailing chars at the end of the provided expression that have not been parsed.
Michael Niedermayer
michaelni
Mon Jun 14 03:33:26 CEST 2010
On Sun, Jun 13, 2010 at 12:07:38PM +0200, Stefano Sabatini wrote:
> On date Sunday 2010-06-13 02:41:35 +0200, Michael Niedermayer encoded:
> > On Sun, Jun 13, 2010 at 12:38:43AM +0200, Stefano Sabatini wrote:
> > > ---
> > > libavutil/eval.c | 8 +++++++-
> > > 1 files changed, 7 insertions(+), 1 deletions(-)
> > >
> > > diff --git a/libavutil/eval.c b/libavutil/eval.c
> > > index 5506822..def3def 100644
> > > --- a/libavutil/eval.c
> > > +++ b/libavutil/eval.c
> > > @@ -451,6 +451,7 @@ int av_parse_expr(AVExpr **expr, const char *s,
> > > AVExpr *e = NULL;
> > > char *w = av_malloc(strlen(s) + 1);
> > > char *wp = w;
> > > + const char *s0 = s;
> > > int ret = 0;
> > >
> > > if (!w)
> >
> > > @@ -470,9 +471,14 @@ int av_parse_expr(AVExpr **expr, const char *s,
> > > p.func2_names = func2_names;
> > > p.log_offset = log_offset;
> > > p.log_ctx = log_ctx;
> > > -
> > > if ((ret = parse_expr(&e, &p)) < 0)
> >
> > ehm
> >
> >
> > > goto end;
> > > + if (*p.s) {
> > > + av_log(log_ctx, AV_LOG_ERROR+log_offset,
> > > + " Invalid chars '%s' at the end of expression '%s'\n", p.s, s0);
> > > + ret = AVERROR(EINVAL);
> > > + goto end;
> > > + }
> >
> > s0 seems unneeded
>
> It is since s is changed by the code:
> while (*s)
> if (!isspace(*s++)) *wp++ = s[-1];
if it makes you happy to print all the extra stuff, well ok
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- 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/20100614/21de770f/attachment.pgp>
More information about the ffmpeg-devel
mailing list