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

Git pushed a commit to branch master
in repository ffmpeg.

commit 16d19ccbce802634662a9bf18a5679cf27da2848
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Thu Sep 17 18:41:48 2026 +0200
Commit:     michaelni <[email protected]>
CommitDate: Sat Sep 19 18:47:12 2026 +0000

    avcodec/mpegvideo_enc: keep MPEG-4 B frame chains within the 16 bit frame 
distance
    
    Fixes: division by zero
    Fixes: 1XvjZP0UGl6O
    Found-by: Gabe Sherman (Trail of Bits)
---
 libavcodec/mpegvideo_enc.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 1a6cdbfdfb..3d749360f9 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1722,6 +1722,12 @@ static int set_bframe_chain_length(MPVMainEncContext 
*const m)
             }
         }
 
+        if (s->c.codec_id == AV_CODEC_ID_MPEG4)
+            while (b_frames &&
+                   m->input_picture[b_frames]->f->pts * 
s->c.avctx->time_base.num -
+                   s->c.last_non_b_time > UINT16_MAX)
+                b_frames--;
+
         for (int i = b_frames - 1; i >= 0; i--) {
             int type = m->input_picture[i]->f->pict_type;
             if (type && type != AV_PICTURE_TYPE_B)

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