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 a0dfb736a6f49f8f4ddca0eedb0091f52aac7538
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Thu Oct 29 00:00:14 2026 +0100
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Sun Nov 15 02:32:56 2026 +0100

    avformat/mux: do not overflow the default block_align computation
    
    Fixes: 6nHC3ciDJMZ6
    Fixes: signed integer overflow
    Signed integer overflow Replicated through UnModified FFmpeg with UBSAN
    Found during triage of the security report Zc8wjsgxLWvu
    
    (cherry picked from commit d9b151c9676ab134434ca28a5c56df08aff605ec)
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavformat/mux.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index 8226840b4c..ba64888260 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -241,9 +241,16 @@ static int init_muxer(AVFormatContext *s, AVDictionary 
**options)
                 goto fail;
             }
 
-            if (!par->block_align)
-                par->block_align = par->ch_layout.nb_channels *
-                                   av_get_bits_per_sample(par->codec_id) >> 3;
+            if (!par->block_align) {
+                int64_t block_align = (int64_t)par->ch_layout.nb_channels *
+                                      av_get_bits_per_sample(par->codec_id) >> 
3;
+                if (block_align < 0 || block_align > INT_MAX) {
+                    av_log(s, AV_LOG_ERROR, "invalid channel count\n");
+                    ret = AVERROR(EINVAL);
+                    goto fail;
+                }
+                par->block_align = block_align;
+            }
             break;
         case AVMEDIA_TYPE_VIDEO:
             if ((par->width <= 0 || par->height <= 0) &&

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