[FFmpeg-cvslog] avformat/mov: Fix ctts_index calculation

Xiaohan Wang git at videolan.org
Sat Feb 10 04:57:46 EET 2018


ffmpeg | branch: master | Xiaohan Wang <xhwang at chromium.org> | Fri Feb  2 17:33:56 2018 -0800| [dd5208aaf5bf229915a4c0e4d58cb063dfcb3b9a] | committer: Michael Niedermayer

avformat/mov: Fix ctts_index calculation

An index should never be equal to the count. Hence we must make sure
*ctts_index < ctts_count.

Reviewed-by: Sasi Inguva <isasi at google.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/mov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index acfbfc5324..04567fc475 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3132,7 +3132,7 @@ static int find_prev_closest_index(AVStream *st,
             }
         }
 
-        while (*index >= 0 && (*ctts_index) >= 0) {
+        while (*index >= 0 && (*ctts_index) >= 0 && (*ctts_index) < ctts_count) {
             // Find a "key frame" with PTS <= timestamp_pts (So that we can decode B-frames correctly).
             // No need to add dts_shift to the timestamp here becase timestamp_pts has already been
             // compensated by dts_shift above.



More information about the ffmpeg-cvslog mailing list