[FFmpeg-cvslog] avformat/utils: Ignore negative duration in codec_info_duration computation

Michael Niedermayer git at videolan.org
Wed Oct 6 19:07:27 EEST 2021


ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Sat Jul  3 23:02:16 2021 +0200| [e075bc192da554b252a4a7d22c159a307724ee83] | committer: Michael Niedermayer

avformat/utils: Ignore negative duration in codec_info_duration computation

Fixes: signed integer overflow: -5994697211974418462 + -3255307777713450286 cannot be represented in type 'long'
Fixes: 35332/clusterfuzz-testcase-minimized-ffmpeg_dem_MATROSKA_fuzzer-5868035117285376

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

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

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

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 20a597a60a..75e5350a27 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3914,7 +3914,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
                     av_packet_unref(pkt1);
                 break;
             }
-            if (pkt->duration) {
+            if (pkt->duration > 0) {
                 if (avctx->codec_type == AVMEDIA_TYPE_SUBTITLE && pkt->pts != AV_NOPTS_VALUE && st->start_time != AV_NOPTS_VALUE && pkt->pts >= st->start_time
                     && (uint64_t)pkt->pts - st->start_time < INT64_MAX
                 ) {



More information about the ffmpeg-cvslog mailing list