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>
This commit is contained in:
Xiaohan Wang 2018-02-02 17:33:56 -08:00 committed by Michael Niedermayer
parent 909e00ae81
commit dd5208aaf5
1 changed files with 1 additions and 1 deletions

View File

@ -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.