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

Git pushed a commit to branch master
in repository ffmpeg.

commit 78afb1d6e99ba2d3264f053ae4c0e4487a9c824c
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Sat Nov 14 05:18:49 2026 +0100
Commit:     michaelni <[email protected]>
CommitDate: Tue Nov 17 23:22:10 2026 +0000

    avfilter/f_zmq: do not store the message size in an int
    
    Fixes: out of array access (memcpy with negative size)
    Fixes: Nf17YjGEKIAG
    Fixes: AISLE-2026-0166-00548
    
    Found-by: Joshua Rogers (AISLE)
    
    Out of array access Replicated through UnModified FFmpeg with ASAN
---
 libavfilter/f_zmq.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/libavfilter/f_zmq.c b/libavfilter/f_zmq.c
index 647ee37963..6b9e55897b 100644
--- a/libavfilter/f_zmq.c
+++ b/libavfilter/f_zmq.c
@@ -115,7 +115,7 @@ static int parse_command(Command *cmd, const char 
*command_str, void *log_ctx)
     return 0;
 }
 
-static int recv_msg(AVFilterContext *ctx, char **buf, int *buf_size)
+static int recv_msg(AVFilterContext *ctx, char **buf)
 {
     ZMQContext *zmq = ctx->priv;
     zmq_msg_t msg;
@@ -135,14 +135,9 @@ static int recv_msg(AVFilterContext *ctx, char **buf, int 
*buf_size)
         goto end;
     }
 
-    *buf_size = zmq_msg_size(&msg) + 1;
-    *buf = av_malloc(*buf_size);
-    if (!*buf) {
+    *buf = av_strndup(zmq_msg_data(&msg), zmq_msg_size(&msg));
+    if (!*buf)
         ret = AVERROR(ENOMEM);
-        goto end;
-    }
-    memcpy(*buf, zmq_msg_data(&msg), *buf_size - 1);
-    (*buf)[*buf_size-1] = 0;
 
 end:
     zmq_msg_close(&msg);
@@ -157,12 +152,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*ref)
     while (1) {
         char cmd_buf[1024];
         char *recv_buf = NULL, *send_buf = NULL;
-        int recv_buf_size;
         Command cmd = {0};
         int ret;
 
         /* receive command */
-        if (recv_msg(ctx, &recv_buf, &recv_buf_size) < 0)
+        if (recv_msg(ctx, &recv_buf) < 0)
             break;
         zmq->command_count++;
 
@@ -196,7 +190,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *ref)
     end:
         av_freep(&send_buf);
         av_freep(&recv_buf);
-        recv_buf_size = 0;
         av_freep(&cmd.target);
         av_freep(&cmd.command);
         av_freep(&cmd.arg);

-- 
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