[FFmpeg-cvslog] lavfi: always check av_expr_parse_and_eval() return value

Vittorio Giovara git at videolan.org
Sat Jan 17 23:20:40 CET 2015


ffmpeg | branch: release/2.4 | Vittorio Giovara <vittorio.giovara at gmail.com> | Wed Dec 17 15:19:43 2014 +0100| [76e9a17f3392e752193015765e9216c2f0716b96] | committer: Luca Barbato

lavfi: always check av_expr_parse_and_eval() return value

CC: libav-stable at libav.org
Bug-Id: CID 703624
(cherry picked from commit 63be97ec403023fb664798432acedaf6e6922527)
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=76e9a17f3392e752193015765e9216c2f0716b96
---

 libavfilter/vf_pad.c   |   14 ++++++++------
 libavfilter/vf_scale.c |    7 ++++---
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c
index 634af4c..bacb505 100644
--- a/libavfilter/vf_pad.c
+++ b/libavfilter/vf_pad.c
@@ -158,9 +158,10 @@ static int config_input(AVFilterLink *inlink)
     var_values[VAR_VSUB]  = 1<<s->vsub;
 
     /* evaluate width and height */
-    av_expr_parse_and_eval(&res, (expr = s->w_expr),
-                           var_names, var_values,
-                           NULL, NULL, NULL, NULL, NULL, 0, ctx);
+    if ((ret = av_expr_parse_and_eval(&res, (expr = s->w_expr),
+                                      var_names, var_values,
+                                      NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
+        goto eval_fail;
     s->w = var_values[VAR_OUT_W] = var_values[VAR_OW] = res;
     if ((ret = av_expr_parse_and_eval(&res, (expr = s->h_expr),
                                       var_names, var_values,
@@ -175,9 +176,10 @@ static int config_input(AVFilterLink *inlink)
     s->w = var_values[VAR_OUT_W] = var_values[VAR_OW] = res;
 
     /* evaluate x and y */
-    av_expr_parse_and_eval(&res, (expr = s->x_expr),
-                           var_names, var_values,
-                           NULL, NULL, NULL, NULL, NULL, 0, ctx);
+    if ((ret = av_expr_parse_and_eval(&res, (expr = s->x_expr),
+                                      var_names, var_values,
+                                      NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
+        goto eval_fail;
     s->x = var_values[VAR_X] = res;
     if ((ret = av_expr_parse_and_eval(&res, (expr = s->y_expr),
                                       var_names, var_values,
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 73ea9d2..2b9e7e8 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -177,9 +177,10 @@ static int config_props(AVFilterLink *outlink)
     var_values[VAR_VSUB]  = 1 << desc->log2_chroma_h;
 
     /* evaluate width and height */
-    av_expr_parse_and_eval(&res, (expr = scale->w_expr),
-                           var_names, var_values,
-                           NULL, NULL, NULL, NULL, NULL, 0, ctx);
+    if ((ret = av_expr_parse_and_eval(&res, (expr = scale->w_expr),
+                                      var_names, var_values,
+                                      NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
+        goto fail;
     scale->w = var_values[VAR_OUT_W] = var_values[VAR_OW] = res;
     if ((ret = av_expr_parse_and_eval(&res, (expr = scale->h_expr),
                                       var_names, var_values,



More information about the ffmpeg-cvslog mailing list