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 63224d717fa092c2ab8e9c2df8d8639c9ba3503e
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Tue Oct 27 13:09:30 2026 +0100
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Sun Nov 15 02:25:55 2026 +0100

    avfilter/af_amerge: check the channel count of each input before summing
    
    Fixes: signed integer overflow
    Fixes: out of array write
    Fixes: 4T4QtWPFfCiD
    Fixes: Depthfirst issue 019f3b84-908c-7752-be91-62fb35f8911e
    Out of array write Replicated through UnModified FFmpeg with ASAN and UBSAN
    The out of array write is a regression since 4e0a8b745a, the overflow
    of the sum is older.
    
    Found-by: Michael Niedermayer <[email protected]> using Depthfirst
    Signed-off-by: Michael Niedermayer <[email protected]>
    (cherry picked from commit b6d737a49c3422ea81381851fa49ef750c9fd367)
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavfilter/af_amerge.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavfilter/af_amerge.c b/libavfilter/af_amerge.c
index 8c574f7bda..07dc804201 100644
--- a/libavfilter/af_amerge.c
+++ b/libavfilter/af_amerge.c
@@ -109,12 +109,12 @@ static int query_formats(AVFilterContext *ctx)
             av_log(ctx, AV_LOG_INFO, "Using \"%s\" for input %d\n", buf, i + 
1);
         }
         s->in[i].nb_ch = INLAYOUT(ctx, i)->nb_channels;
+        if (s->in[i].nb_ch > SWR_CH_MAX - nb_ch) {
+            av_log(ctx, AV_LOG_ERROR, "Too many channels (max %d)\n", 
SWR_CH_MAX);
+            return AVERROR(EINVAL);
+        }
         nb_ch += s->in[i].nb_ch;
     }
-    if (nb_ch > SWR_CH_MAX) {
-        av_log(ctx, AV_LOG_ERROR, "Too many channels (max %d)\n", SWR_CH_MAX);
-        return AVERROR(EINVAL);
-    }
     ret = av_channel_layout_custom_init(&outlayout, nb_ch);
     if (ret < 0)
         return ret;

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