-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4095 +/- ##
==========================================
+ Coverage 11.32% 11.34% +0.02%
==========================================
Files 92 93 +1
Lines 17570 17570
Branches 8238 8238
==========================================
+ Hits 1989 1994 +5
- Misses 13063 14896 +1833
+ Partials 2518 680 -1838
Flags with carried forward coverage won't be shown. Click here to find out more.
|
d517461
to
cf38659
Compare
567fc85
to
39e03f6
Compare
39e03f6
to
29d3bb8
Compare
Bundle ReportBundle size has no change ✅ |
f8649fd
to
53b055b
Compare
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_utils
namespace 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; |
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; |
Copilot uses AI. Check for mistakes.
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
output
line 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
libdisplaydevice
and FFmpeg (libavutil
).Finally, I corrected some IDE and Sonar complaints such as:
Windows.h
include was wrongScreenshot
Issues Fixed or Closed
Type of Change
.github/...
)Checklist