[FFmpeg-cvslog] avformat/concatdec: clip outpoint - inpoint overflow in get_best_effort_duration()

Michael Niedermayer git at videolan.org
Sun Apr 14 20:34:49 EEST 2024


ffmpeg | branch: release/5.1 | Michael Niedermayer <michael at niedermayer.cc> | Tue Dec 26 03:51:23 2023 +0100| [c6c9758e453790ddea7b81c5bafb94c36df4b1ee] | committer: Michael Niedermayer

avformat/concatdec: clip outpoint - inpoint overflow in get_best_effort_duration()

An alternative would be to limit all time/duration fields to below 64bit

Fixes: signed integer overflow: -93000000 - 9223372036839000000 cannot be represented in type 'long long'
Fixes: 64546/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-5110813828186112

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit dd733b2be472cea766c62984237533b239e9a93d)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c6c9758e453790ddea7b81c5bafb94c36df4b1ee
---

 libavformat/concatdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index 8bd0c5c5af..49c12d8dc7 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -322,7 +322,7 @@ static int64_t get_best_effort_duration(ConcatFile *file, AVFormatContext *avf)
     if (file->user_duration != AV_NOPTS_VALUE)
         return file->user_duration;
     if (file->outpoint != AV_NOPTS_VALUE)
-        return file->outpoint - file->file_inpoint;
+        return av_sat_sub64(file->outpoint, file->file_inpoint);
     if (avf->duration > 0)
         return avf->duration - (file->file_inpoint - file->file_start_time);
     if (file->next_dts != AV_NOPTS_VALUE)



More information about the ffmpeg-cvslog mailing list