From 8eb3164878ca159016db6afa5606c4ecc6cebc54 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 8 Jul 2022 12:04:41 +0200 Subject: [PATCH] input/CdioParanoia: fix crash if no drive was found cdio_get_devices_with_cap() can return nullptr if no drive was found, or it can instead return an empty list. The latter caused MPD to crash. --- NEWS | 2 ++ src/input/plugins/CdioParanoiaInputPlugin.cxx | 3 +++ 2 files changed, 5 insertions(+) diff --git a/NEWS b/NEWS index c221a6669..5a9270420 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ ver 0.23.8 (not yet released) * storage - curl: fix crash if web server does not understand WebDAV +* input + - cdio_paranoia: fix crash if no drive was found * output - pipewire: fix crash with PipeWire 0.3.53 * mixer diff --git a/src/input/plugins/CdioParanoiaInputPlugin.cxx b/src/input/plugins/CdioParanoiaInputPlugin.cxx index 55cc2a5a4..29ab784a8 100644 --- a/src/input/plugins/CdioParanoiaInputPlugin.cxx +++ b/src/input/plugins/CdioParanoiaInputPlugin.cxx @@ -176,6 +176,9 @@ cdio_detect_device() AtScopeExit(devices) { cdio_free_device_list(devices); }; + if (devices[0] == nullptr) + return nullptr; + return AllocatedPath::FromFS(devices[0]); }