[FFmpeg-devel] [PATCH 2/5] avformat/mov: Check edit_list_dts_entry_end

Michael Niedermayer michael at niedermayer.cc
Sun Jun 22 00:15:18 EEST 2025


Fixes: signed integer overflow: 5269246886373498912 + 4035225266123964416 cannot be represented in type 'long'
Fixes: 418319157/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5452638340841472

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavformat/mov.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 6e9e3498fb5..401fdf70fb4 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4245,6 +4245,10 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
                st->index, edit_list_index, edit_list_media_time, edit_list_duration);
         edit_list_index++;
         edit_list_dts_counter = edit_list_dts_entry_end;
+        if (av_sat_add64(edit_list_dts_entry_end, edit_list_duration) != edit_list_dts_entry_end + (uint64_t)edit_list_duration) {
+            av_log(mov->fc, AV_LOG_ERROR, "edit_list_durations sum exceed 64bit\n");
+            break;
+        }
         edit_list_dts_entry_end += edit_list_duration;
         num_discarded_begin = 0;
         if (!found_non_empty_edit && edit_list_media_time == -1) {
-- 
2.49.0



More information about the ffmpeg-devel mailing list