1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00

avformat/demux: Check packet duration

Fixes: signed integer overflow: 24320 + 9223372036854775573 cannot be represented in type 'long'
Fixes: 71001/clusterfuzz-testcase-minimized-ffmpeg_dem_MATROSKA_fuzzer-5644785744936960

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:
Michael Niedermayer
2024-08-16 18:14:37 +02:00
parent b9b4c9ebf0
commit f7900a5609

View File

@@ -2810,7 +2810,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
av_packet_unref(pkt1); av_packet_unref(pkt1);
break; break;
} }
if (pkt->duration > 0) { if (pkt->duration > 0 && pkt->duration < INT64_MAX - sti->info->codec_info_duration) {
const int fields = sti->codec_desc && (sti->codec_desc->props & AV_CODEC_PROP_FIELDS); const int fields = sti->codec_desc && (sti->codec_desc->props & AV_CODEC_PROP_FIELDS);
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 && (uint64_t)pkt->pts - st->start_time < INT64_MAX