Repository navigation
fix(videodec2): validate ClearOutput destinations upfront before mutating output - #21081
Conversation
PrivacyOnion
left a comment
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against e1878384d6:
- Conventions:
tools/check_conventions.pyfailed;git diff --checkclean.(pull request): error: [pr-template] Fill in the pull request template: fill Depends on with #N or none 1 findings, 1 errors; GitHub shows at most 10 error annotations, the job summary lists all - Build:
guest_videodec2_hevc_aliases_testsbuilt cleanly. - CTest (
guest_videodec2_hevc_aliases):1/1 Test #4872: guest_videodec2_hevc_aliases ..... Passed 0.02 sec 100% tests passed, 0 tests failed out of 1
Requesting changes for the points above.
|
Thanks @PrivacyOnion! Added |
|
Windows result for head Host: Windows 11 26300, Intel i7-12700K, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release,
AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine. |
|
@PrivacyOnion Updated PR description to match the verbatim 12-item pull request template checklist, resolving the conventions failure. |
|
Tested head Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release,
Whole batch: the full This is one combined tree, not a run of this PR alone. AI-assisted: yes (Claude Code) |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head e1878384d6cb76c5fd3ac317be2018d213e3ac69 using repo_read.py to inspect the prepared diff, the changed files, and relevant helper and caller code. No build or tests were run; the commands in the description are author-reported.
Results
| Check | Result | Note |
|---|---|---|
| Changed code review | passed | All three changed files and their added lines were read. |
| Build and tests | not run | Only author-reported results are available. |
Findings
Blocking
None.
Non-blocking
None.
Not verified
- Build, tests, and convention checks were not run in this review.
files.jsonwas unavailable in the review folder, so excluded paths and any repository-wide review coverage beyond the manifest could not be confirmed.- Console behavior for an unmapped input pointer is unmeasured, as the change’s debt note states.
To get this to a good state
Nothing is required.
|
Windows run of e187838 merged onto Merge state
Measured (Windows)
Inferred / suggestions
Existing runs
Host
AI-assisted: yes |
e187838 to
929db08
Compare
|
@Helldiverr @PrivacyOnion Rebased onto @PrivacyOnion Ready for re-review (GitHub API blocks non-collaborator PR authors from invoking |
929db08 to
3afcb24
Compare
|
Updated in
|
|
I ran 3afcb24 on Windows, merged onto Merge state
Measured (Windows)
Why line 114 fails
Probe
MutationsEach mutation was applied to
Debt fragment
Inferred / not measured
Existing runs
Host
AI-assisted: yes |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
The reviewed change at 3afcb24d6ccfce02bf203c8a0e6bf4dfe2c81d6b has no verified blocking defect; checks reported by the author were not run in this review.
What I ran
Read the prepared description, commit summary, manifest, and diff, then inspected the changed code and relevant guest-memory helper definitions through repo_read.py. No commands or tests were run.
Results
| Check | Result | Note |
|---|---|---|
| Diff and changed code | passed | Three changed files inspected |
| Author-reported tests | not run | Reported as passing in the PR description |
| Negative controls | not run | Results are author-reported |
Negative control
Not run during this review. The author reports two negative controls in the PR description; those results were not independently verified.
Findings
Blocking
None.
Non-blocking
None.
Sources
- Export.cpp at reviewed head
- GuestVideodec2HevcAliases.cpp at reviewed head
- Change debt entry at reviewed head
Not verified
No tests or negative controls were run here. Console behavior is not verified. The PR description and debt entry identify unchecked access-unit data reads and EmitDecoded writes as remaining work; those behaviors were not audited in depth. Read: core/libs/prx/libSceVideodec2/Export.cpp (relevant ranges), core/libs/tests/GuestVideodec2HevcAliases.cpp (full file), and docs/dev/debt/changes/fix-libSceVideodec2-decode-copyin.md (full file). No changed files were excluded by the manifest.
To get this to a good state
Nothing is required.
|
This passed review on 3afcb24, but it now conflicts with main in Export.cpp. Please merge main into the branch and push; it goes back to the merge queue on the new head. |
3afcb24 to
7b2b577
Compare
|
@oneandonlydean @Helldiverr Rebased onto
Verified |
|
I ran 7b2b577 on Windows. Both points from my last run are fixed: the collect loop now repeats until every dirty page is collected, and a read-only Base used
Measured (Windows)
MutationsEach mutation was applied to
Debt
Not measured
Host
AI-assisted: yes |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The change validates the caller’s frame and output destinations before clearing output state; the reviewed code has no verified blocking defects.
What I ran
- Reviewed head
7b2b5777292016e57d0fd8063690452c706c5618. - Read the prepared description, commit summary, manifest and diff, plus all three changed files and targeted caller/helper definitions through
repo_read.py. - No commands or tests were run. The checks listed in the PR description are author-reported.
Results
| Check | Result | Note |
|---|---|---|
| Code review | passed | All changed files read |
| Automated checks | not run | PR description reports four tests and two checks passed |
| Console behavior | not run | No hardware measurement supplied |
Findings
Blocking
None.
Non-blocking
None.
Not verified
- Linux build and test results, debt fold check, and conventions check were not run by this review.
- Console behavior for invalid pointers and
EmitDecodedmetadata writes remain unmeasured, as the change’s debt note states. - No files were excluded: the manifest lists all three changed files as included, and each was read.
To get this to a good state
Nothing is required.
PrivacyOnion
left a comment
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 7b2b577729:
- Conventions:
tools/check_conventions.pypassed. - Build:
guest_videodec2_hevc_aliases_testsbuilt cleanly. - CTest (
guest_videodec2_hevc_aliases):1/1 Test #6162: guest_videodec2_hevc_aliases ..... Passed 0.04 sec 100% tests passed, 0 tests failed out of 1 - Negative control: with
core/libs/prx/libSceVideodec2/Export.cppreverted tomainand the new tests kept, the suite fails:Restoring the change makes it pass again.1/1 Test #6162: guest_videodec2_hevc_aliases .....***Failed 0.03 sec 0% tests passed, 1 tests failed out of 1 - Code reading:
- Verified Export.cpp ClearOutput checks optional frame (sizeof(FrameBuffer)) writability before output validation, throwing Videodec2: invalid argument pointer without opening output or mutating state when frame is unwritable
- Verified OutputInfo destination pointer null check and localOutput.thisSize >= offsetof(OutputInfo, frameFormat) bounds check before output writability check
- Verified HostWrite + GuestWritable_nid_no_patch pairing under saved and restored errno preservation in writableGuest helper
- Verified test coverage in GuestVideodec2HevcAliases.cpp exercising unreadable input, unwritable/read-only frame, unwritable/straddling output, errno preservation, and dirty page write-watch tracking under GuestArena on Linux and Windows
- Verified debt fragment docs/dev/debt/changes/fix-libSceVideodec2-decode-copyin.md adheres to AGENTS.md conventions and records unmeasured hardware behavior
Looks Good To Me
What
Validates cleared guest destinations upfront in
ClearOutput(core/libs/prx/libSceVideodec2/Export.cpp), closing the remaining transactional gap after #20614 landed checkedCopyInGuest/CopyOutGuest/auBytes:frame(sizeof(FrameBuffer)) beforeoutput(min(thisSize, sizeof(OutputInfo))) underGuestArena::HostWritepaired withGuestWritable_nid_no_patchwhile preserving callererrno.Videodec2: invalid argument pointerwithout mutating either struct and without openingoutputinHostWritewhenframeis read-only (keeping write-watched output pages clean on Windows as well as Linux). Applies uniformly to bothsceVideodec2Decode_nid_postfixandsceVideodec2Flush_nid_postfix.core/libs/tests/GuestVideodec2HevcAliases.cppwith unreadable/unwritable pointer,errnopreservation, armedGuestArena(std::array<void*, 64>drain loop for 32 pages inkSpan = 0x20000),sceVideodec2Decode/sceVideodec2Flushread-onlyframenon-mutation/non-dirtying, and page-straddling unwritableoutputchecks, plus debt indocs/dev/debt/changes/fix-libSceVideodec2-decode-copyin.md.Tested
BUILD_TESTING=ON), rebased ontoorigin/main(115a7036e2, PR head7b2b577729):ctest --test-dir /tmp/anyps5_verify_build --output-on-failure -R "^(guest_videodec2|guest_videodec2_hevc_aliases|guest_hevc_metadata|guest_videodec2_unimplemented)$": 4/4 passed (0.24 s), includingguest_videodec2_hevc_aliases(0.01 s).python3 tools/debt_fold.py --checkandpython3 tools/check_conventions.py --base origin/main: passed cleanly.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)