fix(libSceVideodec2): safely copy guest decode and flush buffers #20614
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/20614"
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 PrivacyOnion on 2026-11-15T11:08:36Z.
What
Copy guest
InputData,FrameBuffer,OutputInfo, access unit bytes (auData), and decoded NV12 frame output (frameBuffer) throughGuestCopyIn_nid_no_patch/GuestCopyOut_nid_no_patch(while preservingerrno) insceVideodec2Decode_nid_postfix,sceVideodec2Flush_nid_postfix,ClearOutput,EmitDecoded, andWriteNv12incore/libs/prx/libSceVideodec2/Export.cpp, throwing"Videodec2: invalid argument pointer"on copy failure.Tested
python tools/guest_pointer_audit.py libSceVideodec2->0 direct guest pointer accesses in 0 exported functionspython tools/check_conventions.py --base upstream/main --head fix/videodec2-guest-copy->All conventions checks passed.(exit code 0)g++ -std=gnu++20 -fsyntax-onlycould not complete because3rdparty/ffmpeg-coresubmodule headers (libavcodec/avcodec.h) are not checked out in this worktree.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-11-15T11:39:05Z.
Review: COMMENTED
Reviewed — no blocking findings
The changed file was reviewed at head
e99ed54bf51512e9cf496e2c456edcb3e9d02f94; I found no verified blocking defect, and the reported syntax check could not complete because FFmpeg headers were unavailable.What I ran
Read the prepared description, commits, manifest, diff, and the full changed file through the pinned reader. No commands or tests were run.
Results
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
Tests and build were not run. The reported guest pointer audit and conventions check were author reported, not performed in this review. No changed files were excluded;
core/libs/prx/libSceVideodec2/Export.cppwas read in full.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-15T16:53:18Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: reject undersized
OutputInforecords before attempting the bounded copy.What I ran
55bef73ce83e070cd6a1708060b00e7963f15885using the pinnedrepo_read.pyreader.Results
Findings
Blocking
core/libs/prx/libSceVideodec2/Export.cpp:78:ReadSizedGuestaccepts anythisSize, including values smaller than the 8-byte size field.WriteSizedGuestthen treats that value as a successful copy length; a zero size causes noOutputInfofields to be written, while short sizes can leaveClearOutput’s required invalid/empty result partly or entirely untouched. Reject sizes that cannot hold the required fields before using them, and return a structure-size error or equivalent failure.Non-blocking
core/libs/prx/libSceVideodec2/Export.cpp:450: decoded output now allocates a staging vector for every frame before copying it to guest memory. Consider reusing per-decoder staging storage if this allocation is measurable on common decode workloads.Not verified
core/libs/prx/libSceVideodec2/Export.cppandcore/libs/prx/libSceVideodec2/include/Api.hppwere read. The manifest lists one changed file and marks it included;files.jsonwas not available through the reader, so excluded-file details were not verified.To get this to a good state
OutputInfo::thisSizeagainst the minimum supported size before reading or writing the structure, then rerun relevant tests and checks on the updated head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T06:57:36Z.
Review: APPROVED
Reviewed — looks good
The reviewed change at
29d0ff969445014d5f1e53350b44636e06e6b970safely stages guest decode and flush buffers based on the inspected paths; no blocking defects were verified. Nothing blocks this; the points below are optional.What I ran
No commands were run. I read the prepared diff and the changed source and test files at the pinned head.
Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No commands or tests were run. The PR description reports convention checks passed and syntax checking could not complete due to unavailable FFmpeg submodule headers; these were not independently run. Read:
review/description.md,review/commits.md,review/manifest.json,review/diff.patch,core/libs/prx/libSceVideodec2/Export.cpp,core/libs/prx/libSceVideodec2/include/Api.hpp, andcore/libs/tests/GuestVideodec2.cpp. The manifest lists both changed files as included, and both were read. No excluded changed files were listed.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T07:16:39Z.
Review: APPROVED
Reviewed — looks good
The review covers head
a1578a6638ca4c3ac7c1af90813c13e4e7903d47; the code changes and added tests reviewed show no verified blocking defect, while builds and runtime tests were not run.What I ran
Read the prepared diff and changed source at the pinned head. No commands or tests were run.
Results
Negative control
Not run; no test execution was available.
Findings
Blocking
None.
Non-blocking
None.
Sources
The review used the prepared diff, manifest and description, plus head contents of
core/libs/prx/libSceVideodec2/Export.cpp,core/libs/tests/GuestVideodec2.cpp, anddocs/dev/debt/changes/fix-videodec2-decode-guest-copy.md.Not verified
No tests or build were run. The description reports prior audit/convention checks and a compile attempt blocked by missing FFmpeg submodule headers; these were not independently verified. No files were excluded: all three files listed as reviewed in the manifest were read.
To get this to a good state
Nothing is required.