[FFmpeg-cvslog] avformat/utils: reorder operations in update_wrap_reference()

Michael Niedermayer git at videolan.org
Wed Dec 4 14:55:00 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Dec  4 14:29:35 2013 +0100| [34b16e2d364cf86960eac09e451dae6ae8792e08] | committer: Michael Niedermayer

avformat/utils: reorder operations in update_wrap_reference()

prevents a integer overflow

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

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

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

diff --git a/libavformat/utils.c b/libavformat/utils.c
index f33704d..dcb94e8 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -887,12 +887,11 @@ static int update_wrap_reference(AVFormatContext *s, AVStream *st, int stream_in
 
     if (ref == AV_NOPTS_VALUE)
         ref = pkt->pts;
-    if (ref == AV_NOPTS_VALUE)
+    if (st->pts_wrap_reference != AV_NOPTS_VALUE || st->pts_wrap_bits >= 63 || ref == AV_NOPTS_VALUE || !s->correct_ts_overflow)
         return 0;
     ref &= (1LL<<st->pts_wrap_bits)-1;
 
-    if (s->correct_ts_overflow && st->pts_wrap_bits < 63 &&
-        st->pts_wrap_reference == AV_NOPTS_VALUE) {
+    {
         int i;
 
         // reference time stamp should be 60 s before first time stamp
@@ -945,7 +944,6 @@ static int update_wrap_reference(AVFormatContext *s, AVStream *st, int stream_in
         }
         return 1;
     }
-    return 0;
 }
 
 static void update_initial_timestamps(AVFormatContext *s, int stream_index,



More information about the ffmpeg-cvslog mailing list