playlist.c fix old out of bounds read

In case next_index == -1, this would read before the start of
the playlist->indices buffer.

Change-Id: I0a32a31c7c97c755a1217b8bea90a650f9e36a93
This commit is contained in:
Aidan MacDonald 2023-01-04 19:54:07 +00:00
parent 5d0c382a59
commit 5bb062391f

View file

@ -1828,7 +1828,8 @@ static int get_next_index(const struct playlist_info* playlist, int steps,
} }
/* No luck if the whole playlist was bad. */ /* No luck if the whole playlist was bad. */
if (playlist->indices[next_index] & PLAYLIST_SKIPPED) if (next_index < 0 || next_index >= playlist->amount ||
playlist->indices[next_index] & PLAYLIST_SKIPPED)
return -1; return -1;
return next_index; return next_index;