Repository navigation
fix(libSceVideodec2): reject out-of-order HEVC NAL units - #27925
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Change: Bug fix Merge Risk:
|
PrivacyOnion
left a comment
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 5e16c5ef31:
- Conventions:
tools/check_conventions.pypassed. - Build:
guest_hevc_metadata_testsbuilt cleanly. - CTest (
guest_hevc_metadata):1/1 Test #6231: guest_hevc_metadata .............. Passed 0.14 sec 100% tests passed, 0 tests failed out of 1 - Negative control: with
core/libs/prx/libSceVideodec2/HevcMetadata.cppreverted tomainand the new tests kept, the suite fails:Restoring the change makes it pass again.1/1 Test #6231: guest_hevc_metadata ..............Subprocess aborted***Exception: 0.38 sec 0% tests passed, 1 tests failed out of 1 - Code reading:
- core/libs/prx/libSceVideodec2/HevcMetadata.cpp: verified NAL unit ordering checks in Parse_nid_no_patch against ITU-T H.265 Section 7.4.2.4.4 (leading AUD constraint, parameter sets VPS/SPS/PPS restricted before slices, EOS/EOB ordering and trailing restrictions).
- core/libs/prx/libSceVideodec2/HevcMetadata.cpp: verified state preservation semantics ensuring metadata.unsupported is populated and persistent parser state (vps, sps, pps, afterEnd) remains uncorrupted when returning early on ordering violations.
- core/libs/prx/libSceVideodec2/HevcMetadata.cpp: verified handling of EOS/EOB in access units with missing/unavailable SPS/PPS so afterEnd is properly set while pictureless EOS/EOB sequences are cleanly rejected before loop 2.
- core/libs/tests/GuestHevcMetadata.cpp: verified comprehensive regression coverage in InvalidNalOrder for out-of-order parameter sets, non-leading/duplicate AUD, malformed EOS/EOB sequences, and state persistence assertions.
- core/libs/tests/GuestHevcMetadata.cpp: verified MalformedParameterHistory fixture updates correctly accommodate AUD requirements without masking parser regression checks.
Looks Good To Me
|
Windows at this head ( Setup:
The added test lines have no platform guard. AI-assisted: yes. |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
Nothing blocks this change; the inspected code supports the stated NAL ordering checks and preserves end-state handling when slice metadata cannot be resolved.
What I ran
- Inspected head
5e16c5ef312d72d97853979c43e8eba99e878ba6usingrepo_read.pyto read the prepared diff and both changed files. - No test or build commands were run.
Results
| Check | Result | Note |
|---|---|---|
| Diff and changed code review | passed | Both changed files inspected |
| Tests and build | not run | No execution performed |
Findings
Blocking
None.
Non-blocking
None.
Not verified
- Runtime behavior and test results, including the negative controls, were not verified by execution.
- The changed files were
core/libs/prx/libSceVideodec2/HevcMetadata.cppandcore/libs/tests/GuestHevcMetadata.cpp; both were read. No files were excluded from the prepared manifest.
To get this to a good state
Nothing is required.
Plyxen
left a comment
There was a problem hiding this comment.
Checked head 5e16c5ef31. All on Windows 11 with WinLibs GCC 15.2 (Release), applied to main a163d4b886 together with #27930, #27929, #27926, #27924, #27923, #27922, #27901, #27828, #27771, #27755, #27748, #27682, #27765. tools/check_conventions.py --head and tools/debt_fold.py --check passed and the full build succeeded. guest_hevc_metadata passes. In the full CPU suite (5,120 tests) the only failures are unrelated:
windows_read_trap_unknownfails onmaintoo (fixed in #28028).frame_capture_minimize,jpeg_external_toolchainandguest_pthread_mutex_contentionare timeouts under load; they pass when run on their own.guest_audio_in_capturepasses 20/20 onmainand with #27922.
One non-blocking note: the new rule reports any VPS, SPS or PPS after a slice as unsupported. H.265 7.4.2.4.4 only forbids parameter sets after the last VCL NAL unit of an access unit, so a PPS between two slices of one picture is valid. AvcMetadata.cpp has the same stricter rule for H.264, so this is consistent and safe, because the stream is reported as unsupported rather than accepted. It may be worth a line in docs/dev/debt/libSceVideodec2.md.
AI-assisted: yes (Claude Code)
ligmaSec
left a comment
There was a problem hiding this comment.
The Linux guest_hevc_metadata CTest passed with the exact parser change. The new cases check ordering of parameter sets and access-unit metadata, plus the decoder's ability to continue after rejecting an out-of-order unit.
AI-assisted: yes.
What
Videodec2Hevc::Parse_nid_no_patch(core/libs/prx/libSceVideodec2/HevcMetadata.cpp) before mutating persistent parser state: reject AUD (type 35) when not first, reject VPS/SPS/PPS (types 32-34) after any slice NAL unit, and reject EOS/EOB (types 36-37) when appearing without a slice, beforelastSliceIndex, duplicated, in invalid EOB-before-EOS order, or followed by unexpected NAL units.state.vps,state.sps,state.pps, orstate.afterEnd. Because Loop 1 rejects pictureless EOS/EOB units before Loop 2 runs,if (!selectedSps)retainsif (flags.endSequencePresent || flags.endStreamPresent) state.afterEnd = true;so slice-containing access units with unavailable SPS/PPS still close the sequence/bitstream at EOS/EOB.Tested
InvalidNalOrder(core/libs/tests/GuestHevcMetadata.cpp): negative-control tests verifying out-of-order VPS/SPS/PPS after slices, duplicate or non-leading AUDs, EOS/EOB before the last slice or in invalid sequence/bitstream order, and slice + unavailable SPS + EOS/EOB followed by a non-IRAP slice are rejected (failing onmainand passing with this fix), alongside positive controls for valid EOS/EOB ordering.MalformedParameterHistory(core/libs/tests/GuestHevcMetadata.cpp) and all existing fixture tests: placed the truncated PPS after the leading AUD sostate.unsupportedpersists acrossResetunder valid NAL ordering, verified viaCheckProjectionWrites(decoder, true).Checklist
main; no other open PR implements the same functionstools/check_conventions.pypasses)NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repositorymainand passes after fixSummary by CodeRabbit