[FFmpeg-cvslog] lavf/utils: more complete dts checks

Michael Niedermayer git at videolan.org
Tue Jan 8 00:32:49 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Jan  8 00:24:46 2013 +0100| [953061ed9537f2eecd814842aca6a6fdf8118385] | committer: Michael Niedermayer

lavf/utils: more complete dts checks

Fixes division by zero

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

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

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 5cbf7ca..6f75e43 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2861,7 +2861,8 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
         {
             int64_t last = st->info->last_dts;
 
-            if(pkt->dts != AV_NOPTS_VALUE && last != AV_NOPTS_VALUE && pkt->dts > last){
+            if(   pkt->dts != AV_NOPTS_VALUE && last != AV_NOPTS_VALUE && pkt->dts > last
+               && pkt->dts - (uint64_t)last < INT64_MAX){
                 double dts= (is_relative(pkt->dts) ?  pkt->dts - RELATIVE_TS_BASE : pkt->dts) * av_q2d(st->time_base);
                 int64_t duration= pkt->dts - last;
 



More information about the ffmpeg-cvslog mailing list