test(libSceSaveData.native): cover offset boundaries, null buffers, and uninitialized access in save data memory #12846
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12846"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by slopgobblercobbler on 2026-10-29T12:32:52Z.
What
Zero-Length Request Parity:
main's behavior where zero-length requests (buf_size == 0) succeed without attempting I/O.Export.cppunchanged, relying on the unsignedsize_tcast to reject negative offsets wheneverbuf_size != 0.Test Coverage (
core/libs/tests/GuestSaveDataPs4.cpp):SAVE_DATA_ERROR_NOT_INITIALIZEDerror precedence forsceSaveDataGetSaveDataMemoryandsceSaveDataSetSaveDataMemoryprior to library initialization.SAVE_DATA_ERROR_PARAMETERrejection for non-zero negative offsets (-1), non-zero out-of-bounds offsets (0x1001), and null buffers with non-zero request size.buf_size == 0) succeed with0.Technical Debt Entry (
docs/dev/debt/libSceSaveData.native.md):Tested
ctest --output-on-failure -R GuestSaveDataPs4passed.guest_savedata_ps4passed 3 of 3 (ctest --repeat until-fail:3), none skipped.python tools/check_conventions.py --base upstream/main --head HEAD: 0 findings.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T12:54:17Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The hosted conventions check fails on the PR description, and the new zero-length offset errors assert behavior the PR itself marks unmeasured.
What I ran
Reviewed head
7986d1ce87c7c47bccddfe2a30d4a79a884e9e228againstmainat5454cd2e455994d992aca39335ce60507eeda1eb; the merge preview is clean (542b09ae3caf56684bd2f6113888ab79a3444a60). I inspected the exact diff and current hosted checks. Local environment: Linux x86_64. I did not compile or run the C++ test target.Results
542b09ae3caf56684bd2f6113888ab79a3444a60git diff --check### Whatheading was not detectedRaw local conventions output
Raw hosted conventions failure
Negative control
Not run; I did not modify the code or test assertions.
Findings
Blocking
### What, so the hosted template check does not recognize the required heading. Remove the BOM and rerun the conventions check.getSaveDataMemory2andsetSaveDataMemory2now returnSAVE_DATA_ERROR_PARAMETERwhenoffset > size, even whenbuf_size == 0. On the reviewedmain, zero-length requests bypass range validation and return success. The new tests pin the changed result, while the new debt entry says the rule is unmeasured on console. Please provide console evidence for the zero-length out-of-range behavior or keep zero-length requests as no-ops.SAVE_DATA_ERROR_NOT_INITIALIZEDtoSAVE_DATA_ERROR_PARAMETERfor a negative call made before initialization. Please confirm the intended precedence with console evidence and test that order, or route the check through the initialized API path.Non-blocking
The Windows workflow passes. The Linux build/test lane was skipped, so the checked-in test changes have not been verified in hosted Linux CI.
Sources
7986d1ce87c7c47bccddfe2a30d4a79a884e9e2287986d1ce87c7c47bccddfe2a30d4a79a884e9e228mainbehavior at5454cd2e455994d992aca39335ce60507eeda1eb7986d1ce87c7c47bccddfe2a30d4a79a884e9e228Not verified
To get this to a good state
Remove the description BOM, resolve the two unmeasured behavior changes with evidence or preserve the current zero-length and initialization behavior, and add a negative-offset-before-initialization test if that precedence is retained. I will rerun the same checks on the updated head.