diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2023-01-04 19:54:07 +0000 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2023-01-06 14:19:28 -0500 |
commit | 5bb062391fc259a7bcdd4d69d587ab4adf454e97 (patch) | |
tree | ca526034fa90da4a49cb93a6047e44f0355677dd /apps/playlist.c | |
parent | 5d0c382a59d84208be5ed719b510794f465ccd8b (diff) | |
download | rockbox-5bb062391fc259a7bcdd4d69d587ab4adf454e97.tar.gz rockbox-5bb062391fc259a7bcdd4d69d587ab4adf454e97.zip |
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
Diffstat (limited to 'apps/playlist.c')
-rw-r--r-- | apps/playlist.c | 3 |
1 files changed, 2 insertions, 1 deletions
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, | |||
1828 | } | 1828 | } |
1829 | 1829 | ||
1830 | /* No luck if the whole playlist was bad. */ | 1830 | /* No luck if the whole playlist was bad. */ |
1831 | if (playlist->indices[next_index] & PLAYLIST_SKIPPED) | 1831 | if (next_index < 0 || next_index >= playlist->amount || |
1832 | playlist->indices[next_index] & PLAYLIST_SKIPPED) | ||
1832 | return -1; | 1833 | return -1; |
1833 | 1834 | ||
1834 | return next_index; | 1835 | return next_index; |