Repository navigation
fix(libSceVideodec2): bound cumulative AVC parameter sets before insertion - #12197
oneandonlydean merged 9 commits into
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
The new INT_MAX guard does not stop the memory-retention behavior demonstrated by the linked issue. Its 32-unit reproduction retains 268,434,816 pending bytes (about 277 MB private-memory growth), which is far below INT_MAX; with this patch the same sequence still appends every unit and retains the same memory. The change only caps the accumulation near 2 GiB, which can still exhaust a host before the guard is reached. Please choose and document a practical cumulative cap that prevents the reported reproduction (or otherwise bound/replace retained parameter sets), and add a regression test that verifies rejection happens before insertion and leaves pending state unchanged while the ordinary SPS/PPS-then-slice path still works. The current PR has no test file despite the issue claim comment saying unit coverage would be included. Conventions, eligibility, intake, labels, and report checks pass; Windows build is pending, and other build jobs are path-skipped. I have not reproduced the Windows probe independently.
|
@pushkarreddyy thanks, the bound reads right: it is a byte bound at INT_MAX with the same |
|
@MarcZX10 Thanks for the review observations.
Review Etiquette Reminder: Please note that formal GitHub review decisions ( |
|
The 2 MiB cap now blocks the reported 32 × 8 MiB accumulation, and the check is before Two small follow-ups remain visible on this head: the debt entry still uses the game name “Twispero” alongside |
|
A Windows run: the new test doesn't compile. Head
The hosted AI-assisted: yes (Claude Code). |
|
On head The 2 MiB guard bounds
Could the description distinguish the This is a source-level observation only. I have not run the decoder or measured console behavior. AI-assisted: Codex |
|
@oneandonlydean @MarcZX10 Thanks for the guidance! I applied both updates in commits
|
|
@JJenkx Thank you for catching that! In @mashingaan Thanks for the detailed observation! In commit |
|
@MarcZX10 Also, just wanted to clear up any misunderstanding from my earlier note — frequent, established contributors like yourself, Babyhuehnchen, screaam, etc. are of course very welcome to submit formal GitHub reviews and approvals! Your technical feedback, testing, and reviews are always valued and appreciated. |
|
Windows result for head Host: Windows 11 26300, Intel i7-12700K, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release, The tree also carried the open PRs #12290, #12288, #12285, #12269, #12265, #12232, #12206, #12201, #12199, #12165, #12146, all merged cleanly, so the run is a joint one; the tests of this PR are AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine. |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed the updated head 9da89158de27615f358113f572198c9f4213f4a0. The cumulative 2 MiB check runs before insertion, and the regression test now covers the prior failure mode: it retains a valid parameter set, rejects an oversized following unit, then decodes a valid slice using the retained state. The documented bound matches the implementation. Hosted conventions and Windows checks pass; the author-reported Windows suite covers 38/38 registered tests, including both Videodec2 tests. The Linux/platform-specific jobs were skipped by eligibility, and the Windows run is not PS5 hardware validation. No remaining blocker found in this change.
9da8915 to
18d43f1
Compare
18d43f1 to
cfdff8d
Compare
c89cae3 to
3fd9e0e
Compare
malekaifa
left a comment
There was a problem hiding this comment.
Re-checked exact head 3e532910ea63c9b953134f143c8fb52a2868055b. The blocker from my previous review is resolved: the cumulative AVC parameter-set size is now checked before Parse_nid_no_patch can mutate persistent SPS/PPS state, and the added regression rejects an oversized parameter unit carrying different metadata before decoding a following slice and verifies the original staged metadata is preserved. git diff --check was clean in my prior exact-head source check, and the hosted state is green. I did not run the guest videodec2 runtime test locally on this machine. No remaining blocker found.
AI-assisted: yes (OpenAI ChatGPT).
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
3e53291 to
be521a1
Compare
|
@malekaifa Thank you for re-checking and approving the cumulative AVC parameter set bound enforcement! The branch has been cleanly rebased onto latest |
be521a1 to
0cce455
Compare
e5b7f78 to
88371de
Compare
|
Run of the head pushed at 16:52 UTC today, Setup: Windows 11 Pro 26300, Ryzen 7 7800X3D, WinLibs GCC 15.2.0 r7, Release, Results:
AI-assisted: yes (Claude Code) |
88371de to
e533ff5
Compare
|
Thank you @B-Howell for the comprehensive test verification across Windows 11 and WSL2 Ubuntu (3/3 passed on both hosts, negative control verified, and clean stacked verification with #14998, #14722, and #14074)! The branch has also been cleanly rebased onto latest |
✅ AMD GPU test: passedPR head
Unstable on main (2, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (4, not counted against this PR)Passed on retry (1, failed in the parallel run, passed when re-run with a 360 s timeout; not counted against this PR)Validated but not compared (1, not in the main baseline's validation pass)Validation IDs already present on main (4 IDs in 465 tests)Skipped (6)ReproduceAutomated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
e533ff5 to
4590c33
Compare
… rejected oversized AU
4590c33 to
0ced323
Compare
What
In
libSceVideodec2,sceVideodec2Decodeaccepts AVC access units with no slice NAL (such as standalone SPS/PPS parameter sets) and accumulates them intodecoder.parameterSetsuntil a slice arrives. While single units enforceauSize <= INT_MAX, repeated parameter-set units previously accumulated without enforcing a cumulative bound before vector insertion, permitting host memory growth up to an allocator limit before any slice arrived.Before inserting a parameter-only access unit into
decoder.parameterSets:MaxAvcParameterSetsBytes = 2 * 1024 * 1024), throwingstd::runtime_error("Videodec2: invalid access unit")if accumulation exceeds this bound before vector insertion.PPSA99474indocs/dev/debt/libSceVideodec2.md.Tested
testParameterSetsBoundregression test incore/libs/tests/GuestVideodec2.cppverifying that an initial valid parameter set is retained, an oversized parameter-set access unit (>2 MiB) throwsVideodec2: invalid access unit, and the subsequent slice unit successfully decodes using the retained parameter sets.python tools/check_conventions.py --base origin/mainwith 0 findings.BUILD_TESTING=ON, Ninja): built cleanly, and focused testsguest_videodec2andguest_videodec2_unimplementedpassed without errors (verified by @maskym).Checklist