summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2020-03-07 09:16:37 +0100
committerMax Kellermann <max@musicpd.org>2020-03-07 09:30:56 +0100
commit8d34a1cfc6e5e6e1a5f958160edc78c141854b18 (patch)
treec11a43c2aac4cc4ef9c21e3c2ee9ce011a51a3d2
parent73a1f078a6bb0a2228f7d9e7a48a53382707ec35 (diff)
archive/iso9660: skip empty filenames
Aparently, libcdio sometimes returns empty filenames, causing MPD crashes. This shouldn't really happen, and I consider this a libcdio bug - but if it happens, people blame MPD, so let's add a check. Closes https://github.com/MusicPlayerDaemon/MPD/issues/776
-rw-r--r--NEWS2
-rw-r--r--src/archive/plugins/Iso9660ArchivePlugin.cxx5
2 files changed, 6 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 741938b37..c8742f395 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,6 @@
ver 0.21.21 (not yet released)
+* archive
+ - iso9660: skip empty file names to work around libcdio bug
* decoder
- gme: ignore empty tags
* output
diff --git a/src/archive/plugins/Iso9660ArchivePlugin.cxx b/src/archive/plugins/Iso9660ArchivePlugin.cxx
index 50cea2aef..6cb307bd4 100644
--- a/src/archive/plugins/Iso9660ArchivePlugin.cxx
+++ b/src/archive/plugins/Iso9660ArchivePlugin.cxx
@@ -28,6 +28,7 @@
#include "input/InputStream.hxx"
#include "fs/Path.hxx"
#include "util/RuntimeError.hxx"
+#include "util/StringCompare.hxx"
#include <cdio/iso9660.h>
@@ -93,7 +94,9 @@ Iso9660ArchiveFile::Visit(char *path, size_t length, size_t capacity,
auto *statbuf = (iso9660_stat_t *)
_cdio_list_node_data(entnode);
const char *filename = statbuf->filename;
- if (PathTraitsUTF8::IsSpecialFilename(filename))
+ if (StringIsEmpty(filename) ||
+ PathTraitsUTF8::IsSpecialFilename(filename))
+ /* skip empty names (libcdio bug?) */
/* skip special names like "." and ".." */
continue;