[FFmpeg-cvslog] avutil/log: Set AVClass* in av_expr_eval()

Andreas Rheinhardt git at videolan.org
Sat Mar 8 02:14:43 EET 2025


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Wed Mar  5 03:14:16 2025 +0100| [f641c6846ac419284ae73948b617a250b1a3c22d] | committer: Andreas Rheinhardt

avutil/log: Set AVClass* in av_expr_eval()

Otherwise it is possible for av_log() to receive a non-NULL object
with a NULL AVClass pointer; the default log callback handles it
gracefully, yet this is probably an API violation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavutil/eval.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavutil/eval.c b/libavutil/eval.c
index 298925a6e5..7fa5d5d9d5 100644
--- a/libavutil/eval.c
+++ b/libavutil/eval.c
@@ -791,12 +791,14 @@ int av_expr_count_func(AVExpr *e, unsigned *counter, int size, int arg)
 
 double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
 {
-    Parser p = { 0 };
-    p.var= e->var;
-    p.prng_state= e->prng_state;
+    Parser p = {
+        .class        = &eval_class,
+        .const_values = const_values,
+        .opaque       = opaque,
+        .var          = e->var,
+        .prng_state   = e->prng_state,
+    };
 
-    p.const_values = const_values;
-    p.opaque     = opaque;
     return eval_expr(&p, e);
 }
 



More information about the ffmpeg-cvslog mailing list