[FFmpeg-cvslog] lavf: fix integer overflows

Michael Niedermayer git at videolan.org
Sun Dec 16 01:16:26 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Dec 16 00:56:12 2012 +0100| [1662bd350a470f1cbd5c2cc9a0e1bfaa8543033f] | committer: Michael Niedermayer

lavf: fix integer overflows

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

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

diff --git a/libavformat/utils.c b/libavformat/utils.c
index f627f88..88aacd4 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -91,10 +91,10 @@ static int64_t wrap_timestamp(AVStream *st, int64_t timestamp)
         st->pts_wrap_reference != AV_NOPTS_VALUE && timestamp != AV_NOPTS_VALUE) {
         if (st->pts_wrap_behavior == AV_PTS_WRAP_ADD_OFFSET &&
             timestamp < st->pts_wrap_reference)
-            return timestamp + (1LL<<st->pts_wrap_bits);
+            return timestamp + (1ULL<<st->pts_wrap_bits);
         else if (st->pts_wrap_behavior == AV_PTS_WRAP_SUB_OFFSET &&
             timestamp >= st->pts_wrap_reference)
-            return timestamp - (1LL<<st->pts_wrap_bits);
+            return timestamp - (1ULL<<st->pts_wrap_bits);
     }
     return timestamp;
 }
@@ -925,7 +925,7 @@ static AVPacketList *get_next_pkt(AVFormatContext *s, AVStream *st, AVPacketList
 
 static int update_wrap_reference(AVFormatContext *s, AVStream *st, int stream_index)
 {
-    if (s->correct_ts_overflow && st->pts_wrap_bits != 64 &&
+    if (s->correct_ts_overflow && st->pts_wrap_bits < 63 &&
         st->pts_wrap_reference == AV_NOPTS_VALUE && st->first_dts != AV_NOPTS_VALUE) {
         int i;
 



More information about the ffmpeg-cvslog mailing list