Commit fe7547d6 authored by Matt Wolenetz's avatar Matt Wolenetz Committed by Michael Niedermayer

lavf/utils.c Protect against accessing entries[nb_entries]

In ff_index_search_timestamp(), if b == num_entries,
m == num_entries - 1, and entries[m].flags & AVINDEX_DISCARD_FRAME is
true, then the search for the next non-discarded packet could access
entries[nb_entries], exceeding its bounds. This change adds a protection
against that scenario. Reference: https://crbug.com/666770Reviewed-by: 's avatarSasi Inguva <isasi@google.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 9ec52a0a
......@@ -1981,7 +1981,7 @@ int ff_index_search_timestamp(const AVIndexEntry *entries, int nb_entries,
m = (a + b) >> 1;
// Search for the next non-discarded packet.
while ((entries[m].flags & AVINDEX_DISCARD_FRAME) && m < b) {
while ((entries[m].flags & AVINDEX_DISCARD_FRAME) && m < b && m < nb_entries - 1) {
m++;
if (m == b && entries[m].timestamp >= wanted_timestamp) {
m = b - 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment