[FFmpeg-cvslog] avformat/oggparsetheora: clip duration within 64bit

Michael Niedermayer git at videolan.org
Fri Dec 22 01:51:47 EET 2023


ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Tue May  2 01:46:31 2023 +0200| [94b083010558627a9a40f2acadb2e8d6a23f98af] | committer: Michael Niedermayer

avformat/oggparsetheora: clip duration within 64bit

Fixes: signed integer overflow: 9079256848778919936 - -288230376151711746 cannot be represented in type 'long'
Fixes: 58248/clusterfuzz-testcase-minimized-ffmpeg_dem_OGG_fuzzer-6326851353313280

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 b1c3d81e71f78e4b3b2c2901ac4649cb74aec272)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c
index d1064e4328..293d2928b5 100644
--- a/libavformat/oggparsetheora.c
+++ b/libavformat/oggparsetheora.c
@@ -196,7 +196,7 @@ static int theora_packet(AVFormatContext *s, int idx)
         if(s->streams[idx]->start_time == AV_NOPTS_VALUE && os->lastpts != AV_NOPTS_VALUE) {
             s->streams[idx]->start_time = os->lastpts;
             if (s->streams[idx]->duration > 0)
-                s->streams[idx]->duration -= s->streams[idx]->start_time;
+                s->streams[idx]->duration = av_sat_sub64(s->streams[idx]->duration, s->streams[idx]->start_time);
         }
     }
 



More information about the ffmpeg-cvslog mailing list