From dd5208aaf5bf229915a4c0e4d58cb063dfcb3b9a Mon Sep 17 00:00:00 2001 From: Xiaohan Wang Date: Fri, 2 Feb 2018 17:33:56 -0800 Subject: 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 Signed-off-by: Michael Niedermayer --- libavformat/mov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libavformat/mov.c') 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. -- cgit v1.2.3