fix(libSceVoice): write only the four SDK fields of sceVoiceGetResourceInfo #8688

Closed
JAB-dev wants to merge 1 commit from upstream-pr/8688 into main
JAB-dev commented 2026-10-20 21:06:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JAB-dev on 2026-10-20T21:06:36Z.


sceVoiceGetResourceInfo wrote ten bytes into a structure that is eight bytes in the SDK, so a title that passes its own SceVoiceResourceInfo had the two bytes after it overwritten. It now writes exactly the four SDK fields and nothing else.

What

SceVoiceResourceInfo has four 16-bit fields (voice input ports, voice output ports, device input ports, device output ports), 8 bytes in total, as the PS5 SDK defines SceVoiceResourceInfo (voice_types.h). The repo's VoiceResourceInfo had a fifth 16-bit field, max_ports, written as 64 at offset 8. The field and the write are removed; the four values written are unchanged (their numbers are still Vita-derived, as the debt entry says). The debt entry for sceVoiceGetResourceInfo drops the "64 total ports" limit and the claim that the layout is assumed.

Firmware libSceVoice.sprx, PS5 3.20 (function at 0x14570) and 4.03 (0x14820): the function returns 0x804E0801 for an uninitialized library, 0x804E0805 for a null pointer, otherwise sends one command to the voice service; the module itself has no fifth field to fill. Read from the disassembly, not measured on a console. No firmware bytes are in the repository.

Tested

Windows 11 x64, Release build, MinGW GCC 15.2.0 (WinLibs r7), -DBUILD_TESTING=ON, on main 9d5099f5e. Linux not tested.

  • guest_voice: a wrapper struct holds a real VoiceResourceInfo followed by two guard bytes set to 0xA5; the test asserts the guard sits at offset 8, calls sceVoiceGetResourceInfo on the embedded structure, expects 0, the four values 7, 7, 1, 1, and both guard bytes still 0xA5. The old max_ports == 64 assertion is removed.
  • With Export.cpp and SceTypes.hpp from main, guest_voice aborts at the offset check (exit code 0xc0000409), because main's structure is 10 bytes (the source writes a fifth uint16_t at offset 8); that run does not reach the guard check. As a separate negative control, with this branch's 8-byte header and Export.cpp temporarily writing one extra uint16_t at offset 8, the offset check passes and the test aborts at the guard check; the change was then removed.
  • python tools/check_conventions.py --base origin/main passes and git diff --check is clean.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4942501968 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8688). Originally posted by [JAB-dev](https://github.com/JAB-dev) on 2026-10-20T21:06:36Z. --- `sceVoiceGetResourceInfo` wrote ten bytes into a structure that is eight bytes in the SDK, so a title that passes its own `SceVoiceResourceInfo` had the two bytes after it overwritten. It now writes exactly the four SDK fields and nothing else. ### What `SceVoiceResourceInfo` has four 16-bit fields (voice input ports, voice output ports, device input ports, device output ports), 8 bytes in total, as the PS5 SDK defines `SceVoiceResourceInfo` (`voice_types.h`). The repo's `VoiceResourceInfo` had a fifth 16-bit field, `max_ports`, written as 64 at offset 8. The field and the write are removed; the four values written are unchanged (their numbers are still Vita-derived, as the debt entry says). The debt entry for `sceVoiceGetResourceInfo` drops the "64 total ports" limit and the claim that the layout is assumed. Firmware `libSceVoice.sprx`, PS5 3.20 (function at 0x14570) and 4.03 (0x14820): the function returns 0x804E0801 for an uninitialized library, 0x804E0805 for a null pointer, otherwise sends one command to the voice service; the module itself has no fifth field to fill. Read from the disassembly, not measured on a console. No firmware bytes are in the repository. ### Tested Windows 11 x64, Release build, MinGW GCC 15.2.0 (WinLibs r7), `-DBUILD_TESTING=ON`, on `main` 9d5099f5e. Linux not tested. - `guest_voice`: a wrapper struct holds a real `VoiceResourceInfo` followed by two guard bytes set to 0xA5; the test asserts the guard sits at offset 8, calls `sceVoiceGetResourceInfo` on the embedded structure, expects 0, the four values 7, 7, 1, 1, and both guard bytes still 0xA5. The old `max_ports == 64` assertion is removed. - With `Export.cpp` and `SceTypes.hpp` from `main`, `guest_voice` aborts at the offset check (exit code 0xc0000409), because main's structure is 10 bytes (the source writes a fifth `uint16_t` at offset 8); that run does not reach the guard check. As a separate negative control, with this branch's 8-byte header and `Export.cpp` temporarily writing one extra `uint16_t` at offset 8, the offset check passes and the test aborts at the guard check; the change was then removed. - `python tools/check_conventions.py --base origin/main` passes and `git diff --check` is clean. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-20 21:20:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T21:20:54Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5965 core/libs/SceTypes.hpp
PR 6044 core/libs/tests/GuestVoice.cpp
PR 6090 core/libs/prx/libSceVoice/Export.cpp
core/libs/tests/GuestVoice.cpp
PR 7081 core/libs/SceTypes.hpp
PR 7412 core/libs/SceTypes.hpp
PR 8285 core/libs/SceTypes.hpp
PR 8649 core/libs/SceTypes.hpp
PR 8989 core/libs/prx/libSceVoice/Export.cpp
core/libs/tests/GuestVoice.cpp
docs/dev/debt/libSceVoice.md
PR 9082 core/libs/prx/libSceVoice/Export.cpp
core/libs/tests/GuestVoice.cpp
docs/dev/debt/libSceVoice.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6301743398 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8688#issuecomment-6301743398). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T21:20:54Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 5965](https://www.github.com/boykopovar/AnyPS5/pull/5965) | `core/libs/SceTypes.hpp` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestVoice.cpp` | | [PR 6090](https://www.github.com/boykopovar/AnyPS5/pull/6090) | `core/libs/prx/libSceVoice/Export.cpp`<br>`core/libs/tests/GuestVoice.cpp` | | [PR 7081](https://www.github.com/boykopovar/AnyPS5/pull/7081) | `core/libs/SceTypes.hpp` | | [PR 7412](https://www.github.com/boykopovar/AnyPS5/pull/7412) | `core/libs/SceTypes.hpp` | | [PR 8285](https://www.github.com/boykopovar/AnyPS5/pull/8285) | `core/libs/SceTypes.hpp` | | [PR 8649](https://www.github.com/boykopovar/AnyPS5/pull/8649) | `core/libs/SceTypes.hpp` | | [PR 8989](https://www.github.com/boykopovar/AnyPS5/pull/8989) | `core/libs/prx/libSceVoice/Export.cpp`<br>`core/libs/tests/GuestVoice.cpp`<br>`docs/dev/debt/libSceVoice.md` | | [PR 9082](https://www.github.com/boykopovar/AnyPS5/pull/9082) | `core/libs/prx/libSceVoice/Export.cpp`<br>`core/libs/tests/GuestVoice.cpp`<br>`docs/dev/debt/libSceVoice.md` |
MarcZX10 commented 2026-10-21 01:07:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T01:07:24Z.

Review: APPROVED


Reviewed the diff against current main. The existing 10-byte VoiceResourceInfo and write at offset 8 do overwrite bytes beyond the SDK's four-field, 8-byte PS5 structure. This change removes that write, updates the shared type and debt entry, and adds a guard-byte test that exercises the public export. The reported Windows positive and negative controls are relevant. Current hosted checks pass for eligibility, conventions, intake, labels, and report; platform build jobs are skipped, so I could not independently reproduce the Windows run in this Linux workspace (no existing guest_voice binary, and disk space is nearly exhausted). No blocking code issue found.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5593729688 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8688#pullrequestreview-5593729688). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-21T01:07:24Z. **Review:** APPROVED --- Reviewed the diff against current main. The existing 10-byte VoiceResourceInfo and write at offset 8 do overwrite bytes beyond the SDK's four-field, 8-byte PS5 structure. This change removes that write, updates the shared type and debt entry, and adds a guard-byte test that exercises the public export. The reported Windows positive and negative controls are relevant. Current hosted checks pass for eligibility, conventions, intake, labels, and report; platform build jobs are skipped, so I could not independently reproduce the Windows run in this Linux workspace (no existing guest_voice binary, and disk space is nearly exhausted). No blocking code issue found.
Filip722 commented 2026-10-21 09:33:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Filip722 on 2026-10-21T09:33:38Z.


Linux validation of exact PR head e407e32a353a509a15b83b6da3b6c8228e3d86ca: guest_voice and guest_voice_port_attr each passed three consecutive executions (6 successful executions, no failures or skips).

Environment: Debian 13.7 x86-64, Linux 7.2.9-x64v3-xanmod1, AMD Ryzen 5 7640HS, GCC 15.2.0, CMake 3.31.6. Full Release configuration with BUILD_TESTING=ON, ANYPS5_RELINKER_ONLY=OFF, bundled dependencies; built libSceVoice, both test targets and their dependencies with two jobs.

  • The PR's unmodified regression passes the offset-8 guard check, returns the four expected values 7, 7, 1, 1, and preserves both 0xA5 guard bytes.
  • Negative control: rebuilt only the parent voice translation unit (Export.cpp) with its original SceTypes.hpp from 9d5099f5e76208ff39d2b3bd70c9d96223c5e353 into a separate temporary library, using the same compiler options and PR-built kernel/libc dependencies. Loading that library through LD_LIBRARY_PATH makes the same PR test executable, still compiled with the eight-byte structure, abort with SIGABRT. The parent header was used only to build the old library, so this control does not fail by compiling the caller with the parent's ten-byte structure.
ctest --test-dir build -R '^guest_voice(_port_attr)?$' --repeat until-fail:3 -V

Tracked source files remained unchanged. This is Linux runtime and regression evidence; no new Windows run, PS5 measurement, title, GPU, or full repository test-suite validation was performed. The documented uncertainty in the resource-limit values remains.

AI-assisted testing and report.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6312751133 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8688#issuecomment-6312751133). Originally posted by [Filip722](https://github.com/Filip722) on 2026-10-21T09:33:38Z. --- Linux validation of exact PR head `e407e32a353a509a15b83b6da3b6c8228e3d86ca`: `guest_voice` and `guest_voice_port_attr` each passed three consecutive executions (6 successful executions, no failures or skips). Environment: Debian 13.7 x86-64, Linux `7.2.9-x64v3-xanmod1`, AMD Ryzen 5 7640HS, GCC 15.2.0, CMake 3.31.6. Full Release configuration with `BUILD_TESTING=ON`, `ANYPS5_RELINKER_ONLY=OFF`, bundled dependencies; built `libSceVoice`, both test targets and their dependencies with two jobs. - The PR's unmodified regression passes the offset-8 guard check, returns the four expected values `7, 7, 1, 1`, and preserves both `0xA5` guard bytes. - Negative control: rebuilt only the parent voice translation unit (`Export.cpp`) with its original `SceTypes.hpp` from `9d5099f5e76208ff39d2b3bd70c9d96223c5e353` into a separate temporary library, using the same compiler options and PR-built kernel/libc dependencies. Loading that library through `LD_LIBRARY_PATH` makes the **same PR test executable**, still compiled with the eight-byte structure, abort with `SIGABRT`. The parent header was used only to build the old library, so this control does not fail by compiling the caller with the parent's ten-byte structure. ```sh ctest --test-dir build -R '^guest_voice(_port_attr)?$' --repeat until-fail:3 -V ``` Tracked source files remained unchanged. This is Linux runtime and regression evidence; no new Windows run, PS5 measurement, title, GPU, or full repository test-suite validation was performed. The documented uncertainty in the resource-limit values remains. AI-assisted testing and report.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!8688
No description provided.