From 8169c72ce63ba9315888fd05fe8a7885f93e6f4f Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Sun, 8 Nov 2026 14:53:37 -0600 Subject: CubebUtils: Initialize cubeb_device_collection objects to avoid UB inside cubeb enumerate_devices calls on failure. --- Source/Core/AudioCommon/CubebUtils.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Source/Core/AudioCommon/CubebUtils.cpp') diff --git a/Source/Core/AudioCommon/CubebUtils.cpp b/Source/Core/AudioCommon/CubebUtils.cpp index 0be4fdeb81..4dc34a0d44 100644 --- a/Source/Core/AudioCommon/CubebUtils.cpp +++ b/Source/Core/AudioCommon/CubebUtils.cpp @@ -83,7 +83,7 @@ std::vector> ListInputDevices() { std::vector> devices; - cubeb_device_collection collection; + cubeb_device_collection collection{}; auto cubeb_ctx = GetContext(); const int r = cubeb_enumerate_devices(cubeb_ctx.get(), CUBEB_DEVICE_TYPE_INPUT, &collection); @@ -147,7 +147,7 @@ cubeb_devid GetInputDeviceById(std::string_view id) if (id.empty()) return nullptr; - cubeb_device_collection collection; + cubeb_device_collection collection{}; auto cubeb_ctx = CubebUtils::GetContext(); const int r = cubeb_enumerate_devices(cubeb_ctx.get(), CUBEB_DEVICE_TYPE_INPUT, &collection); @@ -181,7 +181,7 @@ std::vector> ListOutputDevices() { std::vector> devices; - cubeb_device_collection collection; + cubeb_device_collection collection{}; auto cubeb_ctx = GetContext(); if (!cubeb_ctx) return devices; @@ -215,7 +215,7 @@ const void* GetOutputDeviceById(std::string_view id) if (id.empty()) return nullptr; - cubeb_device_collection collection; + cubeb_device_collection collection{}; auto cubeb_ctx = GetContext(); if (!cubeb_ctx) return nullptr; -- cgit v1.2.3