mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
avformat/utils: Avoid overflow in codec_info_duration computation for subtitles
Fixes: signed integer overflow: 9223126845747118112 - -2594073385365397472 cannot be represented in type 'long' Fixes: 34936/clusterfuzz-testcase-minimized-ffmpeg_dem_MATROSKA_fuzzer-6739888002170880 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
bf4e7ec825
commit
ffe4851e23
@ -3843,7 +3843,9 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
|
||||
break;
|
||||
}
|
||||
if (pkt->duration) {
|
||||
if (avctx->codec_type == AVMEDIA_TYPE_SUBTITLE && pkt->pts != AV_NOPTS_VALUE && st->start_time != AV_NOPTS_VALUE && pkt->pts >= st->start_time) {
|
||||
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
|
||||
) {
|
||||
st->internal->info->codec_info_duration = FFMIN(pkt->pts - st->start_time, st->internal->info->codec_info_duration + pkt->duration);
|
||||
} else
|
||||
st->internal->info->codec_info_duration += pkt->duration;
|
||||
|
Loading…
Reference in New Issue
Block a user