fix(keyboard): guard read output buffers #17948

Merged
DonRyuzaki merged 4 commits from upstream-pr/17948 into main 2026-11-15 20:21:55 +00:00
DonRyuzaki commented 2026-11-10 00:38:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DonRyuzaki on 2026-11-10T00:38:43Z.


What

Guard the guest output buffers in sceKeyboardRead and sceKeyboardReadState. sceKeyboardRead stages queued snapshots and advances its history only after the checked write succeeds, so an invalid destination does not discard unread input. Inaccessible non-null output uses the existing null-output error. Exact console error and partial-span behavior remain unverified in keyboard technical debt.

Tested

Merged upstream main 00cb2314f490fea6e113bf9a2773867a60ee4771; exact validated head 0f70520ac3167564f807396f5be5d995b65f0556, tree 87115fadaa2f93604a140013462cfe676aae8e59.

  • The manual source resolution keeps upstream's second-port state response and this PR's checked guest output. The new invalid-pointer regression covers the second port and verifies that host errno is preserved. The existing keyboard test also covers protected output, retained unread history, and successful retry. The keyboard debt entry is retained.
  • Ubuntu 24.04 under WSL2, GCC 13.3, CMake/Ninja Release, bundled dependencies, BUILD_TESTING=ON, eight compiler jobs. The complete libs runtime target and the named focused test executables built on this exact tree. Third-party submodule pins are unchanged from the build cache.
  • public_headers, keyboard_input, and keyboard_dbg_alias each passed three consecutive CTest runs: 9/9 executions across 3 test names, zero skips, 56.76 seconds combined CTest wall time. Used ctest --no-tests=error --output-on-failure --repeat until-fail:3 with the exact-name filter.
  • Literal git diff --check and tools/check_conventions.py against the pinned main and this PR's title/body pass. A merge preview against later main ab6ef0b5629d5f0412217dcceea6deac7b8b0b01 passed before push.
  • This is local Linux validation. A previous head had Windows focused-test and negative-control results; they do not validate the new head. No current-head Windows/macOS, game, console, or GPU execution is claimed. The full project CTest suite was not run.

Checklist

  • Based on current main; no other open PR implements these output guards
  • One topic per PR; follow-ups go in a new PR
  • No code comments except technical debt; unimplemented paths still throw
  • No investigation files or images added; no third-party code added
  • Generic behaviour, not specific to one title
  • Depends on: none; Fixes: none; Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5233637435 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17948). Originally posted by [DonRyuzaki](https://github.com/DonRyuzaki) on 2026-11-10T00:38:43Z. --- ### What Guard the guest output buffers in `sceKeyboardRead` and `sceKeyboardReadState`. `sceKeyboardRead` stages queued snapshots and advances its history only after the checked write succeeds, so an invalid destination does not discard unread input. Inaccessible non-null output uses the existing null-output error. Exact console error and partial-span behavior remain unverified in keyboard technical debt. ### Tested Merged upstream main `00cb2314f490fea6e113bf9a2773867a60ee4771`; exact validated head `0f70520ac3167564f807396f5be5d995b65f0556`, tree `87115fadaa2f93604a140013462cfe676aae8e59`. - The manual source resolution keeps upstream's second-port state response and this PR's checked guest output. The new invalid-pointer regression covers the second port and verifies that host `errno` is preserved. The existing keyboard test also covers protected output, retained unread history, and successful retry. The keyboard debt entry is retained. - Ubuntu 24.04 under WSL2, GCC 13.3, CMake/Ninja Release, bundled dependencies, `BUILD_TESTING=ON`, eight compiler jobs. The complete `libs` runtime target and the named focused test executables built on this exact tree. Third-party submodule pins are unchanged from the build cache. - `public_headers`, `keyboard_input`, and `keyboard_dbg_alias` each passed three consecutive CTest runs: **9/9 executions across 3 test names**, zero skips, 56.76 seconds combined CTest wall time. Used `ctest --no-tests=error --output-on-failure --repeat until-fail:3` with the exact-name filter. - Literal `git diff --check` and `tools/check_conventions.py` against the pinned main and this PR's title/body pass. A merge preview against later main `ab6ef0b5629d5f0412217dcceea6deac7b8b0b01` passed before push. - This is local Linux validation. A previous head had Windows focused-test and negative-control results; they do not validate the new head. No current-head Windows/macOS, game, console, or GPU execution is claimed. The full project CTest suite was not run. ### Checklist - [x] Based on current `main`; no other open PR implements these output guards - [x] One topic per PR; follow-ups go in a new PR - [x] No code comments except technical debt; unimplemented paths still throw - [x] No investigation files or images added; no third-party code added - [x] Generic behaviour, not specific to one title - [x] Depends on: none; Fixes: none; Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
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!17948
No description provided.