From 5bb062391fc259a7bcdd4d69d587ab4adf454e97 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Wed, 4 Jan 2023 19:54:07 +0000 Subject: 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 --- apps/playlist.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/playlist.c b/apps/playlist.c index 80685f8655..b349799269 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -1828,7 +1828,8 @@ static int get_next_index(const struct playlist_info* playlist, int steps, } /* 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 next_index; -- cgit v1.2.3