Description
util::from_hex sized its output as digit_count / 2, so when a value had an odd number of hex digits the leading digit was dropped. Through the config parser (parse_config_integer and list_int_f), this gives:
min_threads = 0x8is parsed as0keybindings = [0x9, 0xA0]maps key0to0xA0instead of key0x9keybindings = [0x1B, 0x123]maps0x1Bto0x23instead of0x123
The fix rounds the byte count up and treats the missing high nibble of the last byte as zero, so an odd-length value reads as if it had a leading 0. Even-length input and the existing truncation of over-long input are unchanged. The pairing salt is the only other caller and always passes exactly 32 digits.
Screenshot
Issues Fixed or Closed
Roadmap Issues
Testing
Added UtilityFromHexTests.OddDigitCountReadsTheLeadingDigitAsTheHighNibble ("8", "ABC" in both byte orders, "1:2:3" with separators).
I built test_sunshine on Linux (Ubuntu 26.04, Debug) and ran --gtest_filter=UtilityFromHexTests.*:ConfigPersistenceTest.*, together with a local, uncommitted config test that applies min_threads = 0x8 and keybindings = [0x9, 0xA0, 0x1B, 0x123] through config::apply_config_for_test:
- on master: both tests fail (
from_hex<uint32_t>("8")is0,min_threadsis0, there is no binding for0x9, and0x1Bmaps to35) - with the fix: all 12 selected tests pass
I did not run the Windows or macOS builds.
Type of Change
- feat: New feature (non-breaking change which adds functionality)
- fix: Bug fix (non-breaking change which fixes an issue)
- docs: Documentation only changes
- style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
- refactor: Code change that neither fixes a bug nor adds a feature
- perf: Code change that improves performance
- test: Adding missing tests or correcting existing tests
- build: Changes that affect the build system or external dependencies
- ci: Changes to CI configuration files and scripts
- chore: Other changes that don't modify src or test files
- revert: Reverts a previous commit
- BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)
Checklist
- Code follows the style guidelines of this project
- Code has been self-reviewed
- Code has been commented, particularly in hard-to-understand areas
- Code docstring/documentation-blocks for new or existing methods/components have been added or updated
- Tests have been added or updated for new or modified functionality, including regression tests for bug fixes
AI Usage
See our AI usage policy.
- AI tools were used while preparing this PR
Found by a defect-hunting pipeline I build and run (Dev-next-gen), using Claude Code with Anthropic's Claude Opus 5.5.
This PR was generated by Claude Code, Claude Opus 5.5, low thinking level
Activity
3Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code