[FFmpeg-cvslog] avformat/utils: Use av_sat_add64() when updating start_time by skip_samples.
Dale Curtis
git at videolan.org
Fri May 29 21:12:54 EEST 2020
ffmpeg | branch: master | Dale Curtis <dalecurtis at chromium.org> | Thu May 14 14:29:15 2020 -0700| [f3068be15b361698429ac205ebc728398b4a3cbb] | committer: Michael Niedermayer
avformat/utils: Use av_sat_add64() when updating start_time by skip_samples.
Avoids overflow from fuzzed skip_samples values.
Signed-off-by: Dale Curtis <dalecurtis at chromium.org>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f3068be15b361698429ac205ebc728398b4a3cbb
---
libavformat/utils.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 2fe58eb8ce..9e3ea421cb 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1156,7 +1156,7 @@ static void update_initial_timestamps(AVFormatContext *s, int stream_index,
if (st->start_time == AV_NOPTS_VALUE && pktl_it->pkt.pts != AV_NOPTS_VALUE) {
st->start_time = pktl_it->pkt.pts;
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && st->codecpar->sample_rate)
- st->start_time += av_rescale_q(st->skip_samples, (AVRational){1, st->codecpar->sample_rate}, st->time_base);
+ st->start_time = av_sat_add64(st->start_time, av_rescale_q(st->skip_samples, (AVRational){1, st->codecpar->sample_rate}, st->time_base));
}
}
@@ -1169,7 +1169,7 @@ static void update_initial_timestamps(AVFormatContext *s, int stream_index,
st->start_time = pts;
}
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && st->codecpar->sample_rate)
- st->start_time += av_rescale_q(st->skip_samples, (AVRational){1, st->codecpar->sample_rate}, st->time_base);
+ st->start_time = av_sat_add64(st->start_time, av_rescale_q(st->skip_samples, (AVRational){1, st->codecpar->sample_rate}, st->time_base));
}
}
More information about the ffmpeg-cvslog
mailing list