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

Git pushed a commit to branch master
in repository ffmpeg.

commit 8d80b13cbe063d950c15de5c4bbfd29ca4045141
Author:     Jun Zhao <[email protected]>
AuthorDate: Mon Mar 9 08:41:56 2026 +0800
Commit:     toots <[email protected]>
CommitDate: Wed Mar 18 02:08:09 2026 +0000

    doc/examples/remux: fix NULL pointer dereference in cleanup
    
    The cleanup path uses `ofmt->flags` to check AVFMT_NOFILE, but
    `ofmt` is only assigned after avformat_alloc_output_context2
    succeeds. If a failure occurs between output context allocation
    and the `ofmt` assignment (e.g. stream_mapping allocation fails),
    ofmt_ctx is non-NULL while ofmt is still NULL, causing a crash.
    
    Use ofmt_ctx->oformat->flags instead, which is always valid when
    ofmt_ctx is non-NULL.
    
    Signed-off-by: Jun Zhao <[email protected]>
---
 doc/examples/remux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/examples/remux.c b/doc/examples/remux.c
index 1f002987c5..1a88f7efe6 100644
--- a/doc/examples/remux.c
+++ b/doc/examples/remux.c
@@ -184,7 +184,7 @@ end:
     avformat_close_input(&ifmt_ctx);
 
     /* close output */
-    if (ofmt_ctx && !(ofmt->flags & AVFMT_NOFILE))
+    if (ofmt_ctx && !(ofmt_ctx->oformat->flags & AVFMT_NOFILE))
         avio_closep(&ofmt_ctx->pb);
     avformat_free_context(ofmt_ctx);
 

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to