[FFmpeg-cvslog] avfilter/vf_tonemap_opencl: Dereference after NULL check

Michael Niedermayer git at videolan.org
Thu Feb 27 19:06:38 EET 2025


ffmpeg | branch: release/4.3 | Michael Niedermayer <michael at niedermayer.cc> | Wed Jul 10 23:47:46 2024 +0200| [156ed79d284f3b8d110c44562ccd997a2f375d40] | committer: Michael Niedermayer

avfilter/vf_tonemap_opencl: Dereference after NULL check

Fixes: CID1437472 Dereference before null check

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit e5c0f56ca09b4cb4ea87a61547218f9c818b52d7)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavfilter/vf_tonemap_opencl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_tonemap_opencl.c b/libavfilter/vf_tonemap_opencl.c
index b880228727..6feb61f56e 100644
--- a/libavfilter/vf_tonemap_opencl.c
+++ b/libavfilter/vf_tonemap_opencl.c
@@ -345,8 +345,7 @@ static int tonemap_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
     int err;
     double peak = ctx->peak;
 
-    AVHWFramesContext *input_frames_ctx =
-        (AVHWFramesContext*)input->hw_frames_ctx->data;
+    AVHWFramesContext *input_frames_ctx;
 
     av_log(ctx, AV_LOG_DEBUG, "Filter input: %s, %ux%u (%"PRId64").\n",
            av_get_pix_fmt_name(input->format),
@@ -354,6 +353,7 @@ static int tonemap_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
 
     if (!input->hw_frames_ctx)
         return AVERROR(EINVAL);
+    input_frames_ctx = (AVHWFramesContext*)input->hw_frames_ctx->data;
 
     output = ff_get_video_buffer(outlink, outlink->w, outlink->h);
     if (!output) {



More information about the ffmpeg-cvslog mailing list