[FFmpeg-cvslog] lavf: fix signed overflow in avformat_find_stream_info()
Mans Rullgard
git at videolan.org
Sun Oct 9 04:09:35 CEST 2011
ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Sat Oct 8 02:06:26 2011 +0100| [a31e9f68a426f634e002282885c6c2eb1bfbea44] | committer: Mans Rullgard
lavf: fix signed overflow in avformat_find_stream_info()
On the first iteration through this code, last_dts is always
INT64_MIN (AV_NOPTS_VALUE) and the subtraction overflows in
an invalid manner. Although the result is only used if the
input values are valid, performing the subtraction is still
not allowed in a strict environment.
Signed-off-by: Mans Rullgard <mans at mansr.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a31e9f68a426f634e002282885c6c2eb1bfbea44
---
libavformat/utils.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 0ba6fc3..e4e6d24 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2358,9 +2358,9 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
}
{
int64_t last = st->info->last_dts;
- int64_t duration= pkt->dts - last;
- if(pkt->dts != AV_NOPTS_VALUE && last != AV_NOPTS_VALUE && duration>0){
+ if(pkt->dts != AV_NOPTS_VALUE && last != AV_NOPTS_VALUE && pkt->dts > last){
+ int64_t duration= pkt->dts - last;
double dur= duration * av_q2d(st->time_base);
// if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
More information about the ffmpeg-cvslog
mailing list