diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2013-04-11 23:54:24 +0200 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2013-04-12 00:09:41 +0200 |
commit | aff6cebb41669a25008f76ce3c310001613e6263 (patch) | |
tree | ce1617feaed9018d96f552a01fbe5b38343b25a7 /libavfilter/vf_overlay.c | |
parent | ed2c827575a665ca29a0cbb0b3393d0621f28424 (diff) |
lavfi/overlay: fix crash in case of invalid expression
Diffstat (limited to 'libavfilter/vf_overlay.c')
-rw-r--r-- | libavfilter/vf_overlay.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c index 5ac114aa9d..b5c3f6f569 100644 --- a/libavfilter/vf_overlay.c +++ b/libavfilter/vf_overlay.c @@ -170,16 +170,21 @@ static void eval_expr(AVFilterContext *ctx, enum EvalTarget eval_tgt) static int set_expr(AVExpr **pexpr, const char *expr, void *log_ctx) { int ret; + AVExpr *old = NULL; if (*pexpr) - av_expr_free(*pexpr); - *pexpr = NULL; + old = *pexpr; ret = av_expr_parse(pexpr, expr, var_names, NULL, NULL, NULL, NULL, 0, log_ctx); - if (ret < 0) + if (ret < 0) { av_log(log_ctx, AV_LOG_ERROR, "Error when evaluating the expression '%s'\n", expr); - return ret; + *pexpr = old; + return ret; + } + + av_expr_free(old); + return 0; } static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, |