Commit 29d18722 authored by stefano's avatar stefano

Make av_parse_expr() fail if there are trailing chars at the end of

the provided expression.

Allow detection of mistyped expressions.

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23629 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 29a4c928
...@@ -448,6 +448,7 @@ int av_parse_expr(AVExpr **expr, const char *s, ...@@ -448,6 +448,7 @@ int av_parse_expr(AVExpr **expr, const char *s,
AVExpr *e = NULL; AVExpr *e = NULL;
char *w = av_malloc(strlen(s) + 1); char *w = av_malloc(strlen(s) + 1);
char *wp = w; char *wp = w;
const char *s0 = s;
int ret = 0; int ret = 0;
if (!w) if (!w)
...@@ -470,6 +471,11 @@ int av_parse_expr(AVExpr **expr, const char *s, ...@@ -470,6 +471,11 @@ int av_parse_expr(AVExpr **expr, const char *s,
if ((ret = parse_expr(&e, &p)) < 0) if ((ret = parse_expr(&e, &p)) < 0)
goto end; 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)) { if (!verify_expr(e)) {
av_free_expr(e); av_free_expr(e);
ret = AVERROR(EINVAL); ret = AVERROR(EINVAL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment