[FFmpeg-cvslog] [ffmpeg] branch master updated. cdbb5f1b93 fftools/ffmpeg_mux_init: Use 64bit for score computation in map_auto_video()

ffmpeg-git at ffmpeg.org ffmpeg-git at ffmpeg.org
Thu Aug 14 03:37:15 EEST 2025


The branch, master has been updated
       via  cdbb5f1b93352f9e7eceb1562ad283a78b546091 (commit)
      from  589b93441741b4ee2b65dd10405bdc44ebd0e8fd (commit)


- Log -----------------------------------------------------------------
commit cdbb5f1b93352f9e7eceb1562ad283a78b546091
Author:     Michael Niedermayer <michael at niedermayer.cc>
AuthorDate: Wed Aug 13 00:59:20 2025 +0200
Commit:     michaelni <michael at niedermayer.cc>
CommitDate: Thu Aug 14 00:36:29 2025 +0000

    fftools/ffmpeg_mux_init: Use 64bit for score computation in map_auto_video()
    
    Fixes: signed integer overflow: 10 * 1952737655 cannot be represented in type 'int'
    Fixes: PoC_avi_demux
    
    Found-by: 2ourc3 (Salim LARGO)
    Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index 4a973e5286..17977eb07f 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -1593,7 +1593,7 @@ static int map_auto_video(Muxer *mux, const OptionsContext *o)
 {
     AVFormatContext *oc = mux->fc;
     InputStream *best_ist = NULL;
-    int best_score = 0;
+    int64_t best_score = 0;
     int qcr;
 
     /* video: highest resolution */
@@ -1604,16 +1604,16 @@ static int map_auto_video(Muxer *mux, const OptionsContext *o)
     for (int j = 0; j < nb_input_files; j++) {
         InputFile *ifile = input_files[j];
         InputStream *file_best_ist = NULL;
-        int file_best_score = 0;
+        int64_t file_best_score = 0;
         for (int i = 0; i < ifile->nb_streams; i++) {
             InputStream *ist = ifile->streams[i];
-            int score;
+            int64_t score;
 
             if (ist->user_set_discard == AVDISCARD_ALL ||
                 ist->st->codecpar->codec_type != AVMEDIA_TYPE_VIDEO)
                 continue;
 
-            score = ist->st->codecpar->width * ist->st->codecpar->height
+            score = ist->st->codecpar->width * (int64_t)ist->st->codecpar->height
                        + 100000000 * !!(ist->st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS)
                        + 5000000*!!(ist->st->disposition & AV_DISPOSITION_DEFAULT);
             if((qcr!=MKTAG('A', 'P', 'I', 'C')) && (ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))

-----------------------------------------------------------------------

Summary of changes:
 fftools/ffmpeg_mux_init.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)


hooks/post-receive
-- 



More information about the ffmpeg-cvslog mailing list