-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix(audio-info): crash when device name contains special characters #4095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix(audio-info): crash when device name contains special characters #4095
Conversation
114b384 to
0b5df33
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #4095 +/- ##
==========================================
+ Coverage 11.98% 12.01% +0.02%
==========================================
Files 87 88 +1
Lines 17572 17572
Branches 8076 8076
==========================================
+ Hits 2106 2111 +5
+ Misses 14569 14565 -4
+ Partials 897 896 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
d517461 to
cf38659
Compare
39e03f6 to
29d3bb8
Compare
Bundle ReportBundle size has no change ✅ |
53b055b to
3e9b451
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes crashes in audio-info and dxgi-info tools when device names contain special characters by implementing proper UTF conversion utilities. The changes include creating a new utf_utils namespace for safer UTF conversion, migrating away from the deprecated Boost.Locale library, and improving code quality with modern C++ best practices.
Key changes:
- Adds new
utf_utilsnamespace with UTF conversion functions to replace the previous platform-specific implementations - Migrates audio-info and dxgi-info tools to use standardized UTF-8 output instead of wide character streams
- Consolidates UTF conversion logic from multiple Windows platform files into a single utility module
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/platform/windows/utf_utils.h |
New header defining UTF conversion utility functions |
src/platform/windows/utf_utils.cpp |
Implementation of UTF-8/UTF-16 conversion functions with proper error handling |
tools/audio.cpp |
Migrated to use utf_utils and std::cout for consistent UTF-8 output |
tools/dxgi.cpp |
Updated to use utf_utils and improved output formatting |
tools/CMakeLists.txt |
Added dependencies for utf_utils and logging to tool builds |
tests/unit/platform/windows/test_utf_utils.cpp |
Comprehensive tests for UTF conversion functions |
src/platform/windows/misc.h |
Removed UTF conversion functions (moved to utf_utils) |
src/platform/windows/misc.cpp |
Migrated to use utf_utils for UTF conversions |
| std::cout << "Device name : " << safe_wstring_output(device_friendly_name.prop.pwszVal) << std::endl; | ||
| std::cout << "Adapter name : " << safe_wstring_output(adapter_friendly_name.prop.pwszVal) << std::endl; | ||
| std::cout << "Device description : " << safe_wstring_output(device_desc.prop.pwszVal) << std::endl; |
Copilot
AI
Jul 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect property access. The line uses device_friendly_name.prop.pwszVal but the property should be accessed as device_friendly_name.prop.pszVal based on the PROPVARIANT structure for string values.
| std::cout << "Device name : " << safe_wstring_output(device_friendly_name.prop.pwszVal) << std::endl; | |
| std::cout << "Adapter name : " << safe_wstring_output(adapter_friendly_name.prop.pwszVal) << std::endl; | |
| std::cout << "Device description : " << safe_wstring_output(device_desc.prop.pwszVal) << std::endl; | |
| std::cout << "Device name : " << safe_wstring_output(device_friendly_name.prop.pszVal) << std::endl; | |
| std::cout << "Adapter name : " << safe_wstring_output(adapter_friendly_name.prop.pszVal) << std::endl; | |
| std::cout << "Device description : " << safe_wstring_output(device_desc.prop.pszVal) << std::endl; |
3e9b451 to
27c9e0b
Compare
|
27c9e0b to
7848661
Compare
|




Description
This PR fixes audio-info (and maybe dxgi-info) from crashing when special characters exist in the device names or any properties.
Additionally, the formatting was slightly modified for dxgi-info. The
outputline was previously included even if the device had no output devices attached. The location of the empty line was also changed.To complete the fix I moved the utf conversion functions out of misc.cpp/h in order to simplify inclusion of these functions in the tool binaries. This is still somewhat more complex than it needs to be due to having to include logging, which requires
libdisplaydeviceand FFmpeg (libavutil).Finally, I corrected some IDE and Sonar complaints such as:
Screenshot
Issues Fixed or Closed
Type of Change
.github/...)Checklist