This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch release/9.1
in repository ffmpeg.

commit 6873aaad8f4c98d2a9c19d57e061b5b4ddea7fdd
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Sat Oct 17 03:22:33 2026 +0200
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Sun Nov 15 02:21:13 2026 +0100

    avcodec/decode: allow a hwaccel free_frame_priv callback without a 
hw_frames_ctx
    
    Found during triage/review of the security report AISLE-2026-R0043
    
    (cherry picked from commit eac2bedcf6245552b39eed32b334851bc6a1b8fa)
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavcodec/decode.c           | 9 ++++-----
 libavcodec/hwaccel_internal.h | 3 ++-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index bed8e41a40..aafe78c848 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -2376,14 +2376,13 @@ int ff_hwaccel_frame_priv_alloc(AVCodecContext *avctx, 
void **hwaccel_picture_pr
     av_assert0(!*hwaccel_picture_private);
 
     if (hwaccel->free_frame_priv) {
-        AVHWFramesContext *frames_ctx;
+        AVHWDeviceContext *device_ctx = NULL;
 
-        if (!avctx->hw_frames_ctx)
-            return AVERROR(EINVAL);
+        if (avctx->hw_frames_ctx)
+            device_ctx = ((AVHWFramesContext 
*)avctx->hw_frames_ctx->data)->device_ctx;
 
-        frames_ctx = (AVHWFramesContext *) avctx->hw_frames_ctx->data;
         *hwaccel_picture_private = 
av_refstruct_alloc_ext(hwaccel->frame_priv_data_size, 0,
-                                                          
frames_ctx->device_ctx,
+                                                          device_ctx,
                                                           
hwaccel->free_frame_priv);
     } else {
         *hwaccel_picture_private = 
av_refstruct_allocz(hwaccel->frame_priv_data_size);
diff --git a/libavcodec/hwaccel_internal.h b/libavcodec/hwaccel_internal.h
index 7224406815..ac860f8ab0 100644
--- a/libavcodec/hwaccel_internal.h
+++ b/libavcodec/hwaccel_internal.h
@@ -154,7 +154,8 @@ typedef struct FFHWAccel {
     /**
      * Callback to free the hwaccel-specific frame data.
      *
-     * @param hwctx a pointer to an AVHWDeviceContext.
+     * @param hwctx a pointer to an AVHWDeviceContext, NULL when the decoder
+     *              has no hw_frames_ctx.
      * @param data the per-frame hardware accelerator private data to be freed.
      */
     void (*free_frame_priv)(AVRefStructOpaque hwctx, void *data);

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to