Repository navigation
fix(libSceJson2): copy Initializer and MemAllocator guest pointers through checked copies - #21556
Gruzzberry wants to merge 1 commit into
Conversation
…rough checked copies Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
I am holding this until there is a build and a test run on the head. The PR says it was not compiled or run, and a reviewer should not be the compiler. |
|
Tested head This PR makes Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release, AI-assisted: yes (Claude Code) |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — changes requested
Changes are required before merge: make both InitParameter overloads use checked guest reads and writes, and keep initialization state consistent if writing back the initializer flag fails.
What I ran
Reviewed head e3c08f719e438ccb3ad1bdce7953972ae8fb14a3. Read description.md, commits.md, manifest.json, diff.patch, and the full changed file core/libs/prx/libSceJson2/Export.cpp in targeted ranges; also read GuestPtr.hpp and Api.hpp. No build or tests were run.
Results
| Check | Result | Note |
|---|---|---|
| Diff and source review | failed | Shared initialization still has unchecked guest accesses |
| Build and tests | not run | No command execution available |
| Changed files | passed | Read the sole file listed as reviewed |
Findings
Blocking
core/libs/prx/libSceJson2/Export.cpp:1578:InitializeResourcescommits global initialization and then writesselfdirectly at line 1595 without checking the guest write. If that write fails, the guest gets no initialized flag while the global state remains initialized, and the call returns success. Propagate a checkedCopyOutfailure and roll back or avoid committing initialization until the write succeeds.core/libs/prx/libSceJson2/Export.cpp:1571: The change checks reads for the legacy initializer overload, but theInitParameter2overload at line 3295 still directly dereferences bothselfandparameter; it passesparameterto the newly checked shared reader as well. Unreadable guest pointers can still fault on this public initialization path. Apply checked copies to that overload too, including validation ofspecialFloatFormatType.
Non-blocking
None.
Not verified
- The author reports that
tools/check_conventions.py --base upstream/mainpassed; I did not run it. The build and runtime behavior were not verified. files.jsonwas not available through the reader, so excluded files could not be checked; the manifest lists one changed file and it was read in full through targeted ranges.
To get this to a good state
- Check guest reads and writes on both initializer overloads, and ensure a failed flag write does not leave shared resources initialized. Re-run the convention check, build, and relevant tests on the updated head.
ligmaSec
left a comment
There was a problem hiding this comment.
Please handle the failed CopyOut calls before reporting success. In Initializer::terminate, the shared state and resources have already been released before the unchecked write to the instance flag. An unwritable instance leaves the caller's flag set even though termination returns zero. The two constructors also ignore a failed write and return with the guest object uninitialized.
AI-assisted: yes.
What
Copy the
InitializerandMemAllocatorguest pointers (self, init parameter) in libSceJson2 throughGuestPtr/GuestByteschecked copies; a failed read returnsJsonErrorInvalidArgument.Tested
Ran
tools/check_conventions.py --base upstream/main(passed). Not built or run (no compiler available);pr_overlap.py --branchdid not finish.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)🤖 Generated with Claude Code