From a303639c9eb889207b67b3abc70942a699bf71f7 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 22 Nov 2016 12:20:18 +0100 Subject: [PATCH] decoder/{gme,sidplay}: fix off-by-one bug in container_scan() Broken by commit 0abee77e626 --- src/decoder/plugins/GmeDecoderPlugin.cxx | 2 +- src/decoder/plugins/SidplayDecoderPlugin.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/decoder/plugins/GmeDecoderPlugin.cxx b/src/decoder/plugins/GmeDecoderPlugin.cxx index acb6745f2..9ae95cd9e 100644 --- a/src/decoder/plugins/GmeDecoderPlugin.cxx +++ b/src/decoder/plugins/GmeDecoderPlugin.cxx @@ -125,7 +125,7 @@ gme_container_scan(Path path_fs) const char *subtune_suffix = uri_get_suffix(path_fs.c_str()); auto tail = list.before_begin(); - for (unsigned i = 1; i < num_songs; ++i) { + for (unsigned i = 1; i <= num_songs; ++i) { char track_name[64]; snprintf(track_name, sizeof(track_name), SUBTUNE_PREFIX "%03u.%s", i, subtune_suffix); diff --git a/src/decoder/plugins/SidplayDecoderPlugin.cxx b/src/decoder/plugins/SidplayDecoderPlugin.cxx index 42a4d595f..d65ea8d4c 100644 --- a/src/decoder/plugins/SidplayDecoderPlugin.cxx +++ b/src/decoder/plugins/SidplayDecoderPlugin.cxx @@ -499,7 +499,7 @@ sidplay_container_scan(Path path_fs) return list; auto tail = list.before_begin(); - for (unsigned i = 1; i < n_tracks; ++i) { + for (unsigned i = 1; i <= n_tracks; ++i) { char track_name[32]; /* Construct container/tune path names, eg. Delta.sid/tune_001.sid */