Skip to content

Conversation

@ReenigneArcher
Copy link
Member

@ReenigneArcher ReenigneArcher commented Jul 18, 2025

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:

  • used c-style cast instead of c++ style
  • added const when possible
  • added a default case for a switch
  • some variables could be initialized inside the if condition

Screenshot

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update (updates to dependencies)
  • Documentation update (changes to documentation)
  • Repository update (changes to repository files, e.g. .github/...)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

@ReenigneArcher ReenigneArcher force-pushed the fix/audio-info/crash-when-device-name-contains-special-characters branch 2 times, most recently from 114b384 to 0b5df33 Compare July 18, 2025 22:00
@codecov
Copy link

codecov bot commented Jul 18, 2025

Codecov Report

❌ Patch coverage is 51.38889% with 35 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (master@fd2bfaa). Learn more about missing BASE report.
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/platform/windows/utf_utils.cpp 40.62% 9 Missing and 10 partials ⚠️
src/platform/windows/audio.cpp 0.00% 6 Missing ⚠️
src/platform/windows/misc.cpp 80.00% 5 Missing ⚠️
src/platform/windows/display_base.cpp 60.00% 2 Missing ⚠️
src/platform/windows/publish.cpp 0.00% 2 Missing ⚠️
src/process.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master    #4095   +/-   ##
=========================================
  Coverage          ?   15.48%           
=========================================
  Files             ?       94           
  Lines             ?    19025           
  Branches          ?     8772           
=========================================
  Hits              ?     2946           
  Misses            ?    14443           
  Partials          ?     1636           
Flag Coverage Δ
Archlinux 11.54% <ø> (?)
FreeBSD-14.3-amd64 13.80% <ø> (?)
Homebrew-ubuntu-22.04 13.82% <ø> (?)
Linux-AppImage 11.85% <ø> (?)
Windows-AMD64 13.47% <51.38%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/platform/windows/display_vram.cpp 8.95% <100.00%> (ø)
src/process.cpp 1.28% <0.00%> (ø)
src/platform/windows/display_base.cpp 35.59% <60.00%> (ø)
src/platform/windows/publish.cpp 0.00% <0.00%> (ø)
src/platform/windows/misc.cpp 15.56% <80.00%> (ø)
src/platform/windows/audio.cpp 25.13% <0.00%> (ø)
src/platform/windows/utf_utils.cpp 40.62% <40.62%> (ø)

@ReenigneArcher ReenigneArcher force-pushed the fix/audio-info/crash-when-device-name-contains-special-characters branch 4 times, most recently from d517461 to cf38659 Compare July 18, 2025 23:47
@ReenigneArcher ReenigneArcher requested a review from Copilot July 19, 2025 03:39

This comment was marked as outdated.

@ReenigneArcher ReenigneArcher force-pushed the fix/audio-info/crash-when-device-name-contains-special-characters branch 4 times, most recently from 39e03f6 to 29d3bb8 Compare July 19, 2025 14:37
@codecov
Copy link

codecov bot commented Jul 19, 2025

Bundle Report

Bundle size has no change ✅

@ReenigneArcher ReenigneArcher force-pushed the fix/audio-info/crash-when-device-name-contains-special-characters branch 2 times, most recently from 53b055b to 3e9b451 Compare July 19, 2025 19:50
@ReenigneArcher ReenigneArcher requested a review from Copilot July 19, 2025 22:37

This comment was marked as resolved.

@ReenigneArcher ReenigneArcher force-pushed the fix/audio-info/crash-when-device-name-contains-special-characters branch from 3e9b451 to 27c9e0b Compare September 1, 2025 20:25
@LizardByte LizardByte deleted a comment from sonarqubecloud bot Sep 1, 2025
@ReenigneArcher ReenigneArcher force-pushed the fix/audio-info/crash-when-device-name-contains-special-characters branch from 27c9e0b to 7848661 Compare October 6, 2025 22:01
@LizardByte-bot

This comment was marked as resolved.

@ReenigneArcher ReenigneArcher force-pushed the fix/audio-info/crash-when-device-name-contains-special-characters branch from 7848661 to 1d1288c Compare January 17, 2026 00:46
@LizardByte LizardByte deleted a comment from sonarqubecloud bot Jan 17, 2026
@LizardByte LizardByte deleted a comment from sonarqubecloud bot Jan 17, 2026
Replaces the fixed-size wchar_t array with a std::vector<wchar_t> for constructing the environment block. This improves safety and flexibility by avoiding stack allocation for large environment blocks and using dynamic memory management.
@ReenigneArcher ReenigneArcher force-pushed the fix/audio-info/crash-when-device-name-contains-special-characters branch 2 times, most recently from 85ff42b to 554d2a9 Compare January 17, 2026 01:29
The create_environment_block function now takes a const reference to bp::environment, ensuring the environment is not modified and allowing the function to accept const arguments.
Moves the declaration of the iterator inside the if statement for clarity and restricts its scope to where it is used in the case-insensitive environment variable search.
@ReenigneArcher ReenigneArcher force-pushed the fix/audio-info/crash-when-device-name-contains-special-characters branch from 34983ed to 17e549f Compare January 17, 2026 02:36
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 17, 2026

Quality Gate Passed Quality Gate passed

Issues
0 New issues
1 Accepted issue

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@ReenigneArcher ReenigneArcher merged commit ab52e27 into master Jan 17, 2026
53 checks passed
@ReenigneArcher ReenigneArcher deleted the fix/audio-info/crash-when-device-name-contains-special-characters branch January 17, 2026 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"audio-info.exe" - sanitization of escape characters needed for program output

3 participants