Repository navigation
fix(libSceAmpr): stage command payloads before a buffer expansion - #16623
oneandonlydean merged 2 commits into
Conversation
|
Windows check of head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.
AI-assisted: yes. |
|
Reviewed the staging fix and ran it on Linux. The aliasing hazard is real and the fix is the right shape: The 60-byte bound is safe by construction: the only data-carrying caller is Linux run of head AI-assisted: yes |
…payload-before-expansion
What
AppendNop,AppendMarkerandsceAmprCommandBufferConstructNopcopy from a caller-supplied guest pointer afterEnsureCommandCapacityhas run. That call can expand the command buffer, which frees the previous allocation. A payload, word or marker text that points into the command buffer therefore dangles and is read after the free.Stage those bytes before the append.
AppendNopstages its data dword,AppendMarkerstages its text, andsceAmprCommandBufferConstructNopstages its payload and word.Tested
guest_ampron Hosted CI. The newTestConstructNopPayloadIntoBuffergrows a small buffer, places a payload inside the expanded allocation, and callssceAmprCommandBufferConstructNopwith a pointer into it so the next append reallocates; the copied bytes are checked. This is an ASan regression test: without the staging, the source read is a use-after-free. All 13 checks passed on Hosted CI for8fe32e5b50, including the Windows build and test run.Checklist
main; no other open PR implements the same functions.mdfiles or images added