summaryrefslogtreecommitdiff
path: root/libavutil/eval.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2010-06-16 18:27:55 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2010-06-16 18:27:55 +0000
commit7ec9b9beca13f617c1464444df3707ce2c619906 (patch)
treef9c079047be322e96e9acef1ca70875cae23360b /libavutil/eval.c
parentc1b81d2fd3461e6f2618fac51d42e3781ee1ce75 (diff)
Make av_parse_expr() fail if there are trailing chars at the end of
the provided expression. Allow detection of mistyped expressions. Originally committed as revision 23629 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/eval.c')
-rw-r--r--libavutil/eval.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavutil/eval.c b/libavutil/eval.c
index 530e79a7be..065625c9a6 100644
--- a/libavutil/eval.c
+++ b/libavutil/eval.c
@@ -448,6 +448,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,6 +471,11 @@ int av_parse_expr(AVExpr **expr, const char *s,
if ((ret = parse_expr(&e, &p)) < 0)
goto end;
+ if (*p.s) {
+ av_log(&p, AV_LOG_ERROR, "Invalid chars '%s' at the end of expression '%s'\n", p.s, s0);
+ ret = AVERROR(EINVAL);
+ goto end;
+ }
if (!verify_expr(e)) {
av_free_expr(e);
ret = AVERROR(EINVAL);