summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiaohan Wang <xhwang@chromium.org>2018-02-02 17:33:56 -0800
committerMichael Niedermayer <michael@niedermayer.cc>2018-02-10 03:57:13 +0100
commitdd5208aaf5bf229915a4c0e4d58cb063dfcb3b9a (patch)
tree4bd4c34b7d5ba05fe1a5007dfb307d0bb7287a4c
parent909e00ae816df9b6a05b1c4d0cafb794d4d0ca28 (diff)
downloadffmpeg-dd5208aaf5bf229915a4c0e4d58cb063dfcb3b9a.tar.gz
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@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/mov.c2
1 files changed, 1 insertions, 1 deletions
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.