summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.