From bb376fd2de5da5f9ecdef41621a579252b899d7d Mon Sep 17 00:00:00 2001
From: Xiaohan Wang <xhw...@chromium.org>
Date: Fri, 2 Feb 2018 17:33:56 -0800
Subject: [PATCH] Fix ctts_index calculation

An index should never be equal to the count. Hence we must make sure
*ctts_index < ctts_count.
---
 libavformat/mov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 5adba52e08..f0bd3e3623 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3148,7 +3148,7 @@ static int find_prev_closest_index(AVStream *st,
         *ctts_index = 0;
         *ctts_sample = 0;
         for (index_ctts_count = 0; index_ctts_count < *index; index_ctts_count++) {
-            if (*ctts_index < ctts_count) {
+            if (*ctts_index < ctts_count - 1) {
                 (*ctts_sample)++;
                 if (ctts_data[*ctts_index].count == *ctts_sample) {
                     (*ctts_index)++;
-- 
2.16.0.rc1.238.g530d649a79-goog

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to