feat(libSceVideodec): check sceVideodecMapMemory's arguments as firmware 13.42 does #19451

Merged
BunnyFl merged 2 commits from upstream-pr/19451 into main 2026-11-18 10:43:57 +00:00
BunnyFl commented 2026-11-13 10:51:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-13T10:51:14Z.


What

sceVideodecMapMemory now returns the argument errors firmware 13.42 returns before it calls into the decoder, and still throws after those checks. It gets the parameters the checks read: (SceVideodec::Ctrl* ctrl, const void* memory).

Check, in the module's order Error
ctrl or memory null 0x80c1000f
ctrl->thisSize (64-bit) is not 24 0x80c10002
the 64-bit size at memory+0 is not 0x20, 0x28 or 0x48 0x80c10002
ctrl->handle (ctrl+8) is null 0x80c10003
the size is 0x28 or 0x48 and the 32-bit field at memory+0x20 is not 0 0x80c10000

The one call on each failing path is the module's printf (PLT stub 0x1a20, slot 0x8048, imported as hcuQgD53UxM), which writes a [%s@%04X%04X:%08llX] debug line. That print is not reproduced: a title cannot observe it beyond debug output.

Notes:

  • The memory-size check is lea -0x20(%rcx),%rax; cmp $0x28,%rax; ja, then bt %rax against 0x10000000101 (bits 0, 8 and 40), so exactly 0x20, 0x28 and 0x48 pass. With 0x20 the module skips the +0x20 field and goes straight to the decoder call.
  • The handle check tests the pointer stored in the control block (mov 0x8(%rdi),%rax; test %rax,%rax), not a lookup of a created decoder; the passing path calls the decoder's import (0x1b10, slot 0x80c0) with the pointer stored at handle+0x50 (mov 0x50(%rax),%rdi), and that path keeps throwing.
  • Each field is copied in with its own GuestCopyIn_nid_no_patch right before its check, in the module's order (only ctrl+8 for the handle, and memory+8 to +0x23, which the module reads before it tests +0x20). A field that cannot be read falls through to the throw, where the console would fault. The library's other exports answer an unreadable control or argument block with 0x80c1000f (an unreadable frame buffer with 0x80c1000c); that host-safety fallback is theirs and is not extended to this export.
  • The test is a new testMapMemory in the existing core/libs/tests/GuestVideodec.cpp (guest_videodec), called after the existing ones. The debt entry for sceVideodecMapMemory now says what still throws and that the print is not reproduced. No open pull request touches any of these files.

Source

Firmware 13.42 system/common/lib/libSceVideodec.sprx (sha256 2f595fa415a77ff34e283d1cbd5bcd02331d856381579a98d20a7f5dac49468d), read from disassembly, not run on a console. The entry (kg+lH0V61hM, 0xbd0) comes from the module's dynamic symbol table; the PLT slots were named through the firmware test harness's relocation table (review-tools/emu_sprx.py). 0x1a30 (slot 0x8050, Ou3iL1abvng) is the stack-protector failure path.

Listing: sceVideodecMapMemory from its entry to its returns
bd0: 55                             push %rbp
bd1: 48 89 e5                       mov %rsp,%rbp
bd4: 53                             push %rbx
bd5: 48 83 ec 28                    sub $0x28,%rsp
bd9: 48 8b 1d 30 74 00 00           mov 0x7430(%rip),%rbx # 0x8010
be0: 48 85 ff                       test %rdi,%rdi
be3: 0f 95 c2                       setne %dl
be6: 48 85 f6                       test %rsi,%rsi
be9: 0f 95 c1                       setne %cl
bec: 48 8b 03                       mov (%rbx),%rax
bef: 48 89 45 f0                    mov %rax,-0x10(%rbp)
bf3: 84 ca                          test %cl,%dl
bf5: 0f 84 8a 00 00 00              je 0xc85
bfb: 48 83 3f 18                    cmpq $0x18,(%rdi)
bff: 0f 85 ac 00 00 00              jne 0xcb1
c05: 48 8b 0e                       mov (%rsi),%rcx
c08: 48 8d 41 e0                    lea -0x20(%rcx),%rax
c0c: 48 83 f8 28                    cmp $0x28,%rax
c10: 0f 87 36 01 00 00              ja 0xd4c
c16: 48 ba 01 01 00 00 00 01 00 00  movabs $0x10000000101,%rdx
c20: 48 0f a3 c2                    bt %rax,%rdx
c24: 0f 83 22 01 00 00              jae 0xd4c
c2a: 48 8b 47 08                    mov 0x8(%rdi),%rax
c2e: 48 85 c0                       test %rax,%rax
c31: 0f 84 a6 00 00 00              je 0xcdd
c37: c4 e3 79 04 46 08 4e           vpermilps $0x4e,0x8(%rsi),%xmm0
c3e: c5 f8 11 45 d0                 vmovups %xmm0,-0x30(%rbp)
c43: 48 8b 56 18                    mov 0x18(%rsi),%rdx
c47: 48 89 55 e0                    mov %rdx,-0x20(%rbp)
c4b: 48 83 f9 48                    cmp $0x48,%rcx
c4f: 74 0a                          je 0xc5b
c51: 48 83 f9 28                    cmp $0x28,%rcx
c55: 0f 85 ab 00 00 00              jne 0xd06
c5b: 44 8b 46 20                    mov 0x20(%rsi),%r8d
c5f: 4d 85 c0                       test %r8,%r8
c62: 0f 84 9e 00 00 00              je 0xd06
c68: 48 8d 3d 8b 36 00 00           lea 0x368b(%rip),%rdi # 0x42fa
c6f: 48 8d 35 7b 36 00 00           lea 0x367b(%rip),%rsi # 0x42f1
c76: ba 1a a0 00 00                 mov $0xa01a,%edx
c7b: b9 fd 02 00 00                 mov $0x2fd,%ecx
c80: e9 b9 00 00 00                 jmp 0xd3e
c85: 48 8d 3d 6e 36 00 00           lea 0x366e(%rip),%rdi # 0x42fa
c8c: 48 8d 35 5e 36 00 00           lea 0x365e(%rip),%rsi # 0x42f1
c93: ba 1a a0 00 00                 mov $0xa01a,%edx
c98: b9 dd 02 00 00                 mov $0x2dd,%ecx
c9d: 45 31 c0                       xor %r8d,%r8d
ca0: 31 c0                          xor %eax,%eax
ca2: e8 79 0d 00 00                 call 0x1a20
ca7: b8 0f 00 c1 80                 mov $0x80c1000f,%eax
cac: e9 ba 00 00 00                 jmp 0xd6b
cb1: 48 8d 3d 42 36 00 00           lea 0x3642(%rip),%rdi # 0x42fa
cb8: 48 8d 35 32 36 00 00           lea 0x3632(%rip),%rsi # 0x42f1
cbf: ba 1a a0 00 00                 mov $0xa01a,%edx
cc4: b9 e2 02 00 00                 mov $0x2e2,%ecx
cc9: 45 31 c0                       xor %r8d,%r8d
ccc: 31 c0                          xor %eax,%eax
cce: e8 4d 0d 00 00                 call 0x1a20
cd3: b8 02 00 c1 80                 mov $0x80c10002,%eax
cd8: e9 8e 00 00 00                 jmp 0xd6b
cdd: 48 8d 3d 16 36 00 00           lea 0x3616(%rip),%rdi # 0x42fa
ce4: 48 8d 35 06 36 00 00           lea 0x3606(%rip),%rsi # 0x42f1
ceb: ba 1a a0 00 00                 mov $0xa01a,%edx
cf0: b9 ee 02 00 00                 mov $0x2ee,%ecx
cf5: 45 31 c0                       xor %r8d,%r8d
cf8: 31 c0                          xor %eax,%eax
cfa: e8 21 0d 00 00                 call 0x1a20
cff: b8 03 00 c1 80                 mov $0x80c10003,%eax
d04: eb 65                          jmp 0xd6b
d06: c7 45 e8 00 00 00 00           movl $0x0,-0x18(%rbp)
d0d: 48 8d 75 d0                    lea -0x30(%rbp),%rsi
d11: ba 01 00 00 00                 mov $0x1,%edx
d16: 48 8b 78 50                    mov 0x50(%rax),%rdi
d1a: e8 f1 0d 00 00                 call 0x1b10
d1f: 85 c0                          test %eax,%eax
d21: 74 46                          je 0xd69
d23: 41 89 c0                       mov %eax,%r8d
d26: 48 8d 3d cd 35 00 00           lea 0x35cd(%rip),%rdi # 0x42fa
d2d: 48 8d 35 bd 35 00 00           lea 0x35bd(%rip),%rsi # 0x42f1
d34: ba 1a a0 00 00                 mov $0xa01a,%edx
d39: b9 0b 03 00 00                 mov $0x30b,%ecx
d3e: 31 c0                          xor %eax,%eax
d40: e8 db 0c 00 00                 call 0x1a20
d45: b8 00 00 c1 80                 mov $0x80c10000,%eax
d4a: eb 1f                          jmp 0xd6b
d4c: 48 8d 3d a7 35 00 00           lea 0x35a7(%rip),%rdi # 0x42fa
d53: 48 8d 35 97 35 00 00           lea 0x3597(%rip),%rsi # 0x42f1
d5a: ba 1a a0 00 00                 mov $0xa01a,%edx
d5f: b9 e9 02 00 00                 mov $0x2e9,%ecx
d64: e9 60 ff ff ff                 jmp 0xcc9
d69: 31 c0                          xor %eax,%eax
d6b: 48 8b 0b                       mov (%rbx),%rcx
d6e: 48 3b 4d f0                    cmp -0x10(%rbp),%rcx
d72: 75 07                          jne 0xd7b
d74: 48 83 c4 28                    add $0x28,%rsp
d78: 5b                             pop %rbx
d79: 5d                             pop %rbp
d7a: c3                             ret
d7b: e8 b0 0c 00 00                 call 0x1a30
d80: 0f 0b                          ud2

Tested

Windows 11 Pro 10.0.26300, WinLibs GCC 15.2, Release, head e454c627d5 (based on main 00b3b52a3e).

  • guest_videodec: passes, none Not Run, with libSceVideodec and the test executable rebuilt. The new testMapMemory drives every error in the table above: both nulls; a control block size of 32; nine memory sizes around the accepted three (0, 0x18, 0x1f, 0x21, 0x30, 0x40, 0x47, 0x49, 0x50) with a null handle, so the size check is shown to come before the handle check; a null handle for each accepted size with a non-zero +0x20 field, so the handle check is shown to come before that field; and three non-zero +0x20 values for sizes 0x28 and 0x48. It calls no passing path.
  • Negative control: at ad644d076a, a throwaway commit on e454c627d5 that puts main's throwing body back into sceVideodecMapMemory and keeps the test and the signature, guest_videodec fails with sceVideodecMapMemory not implemented.
  • tools/check_conventions.py --base upstream/main on the committed head: all checks pass.
  • review-tools' sig_users.py HEAD --build: builds every target that names the changed declaration.
  • tools/pr_overlap.py --branch feat/videodec-mapmemory-checks --jobs 8 on the head: no overlap with open pull requests.
  • Upkeep 2026-11-18: merged main 648ba19b3e into the branch as e3e8172ed6, with no conflicts. On that head: tools/check_conventions.py --base upstream/main passes, guest_videodec: 1 of 1 pass, none Not Run, review-tools' sig_users.py HEAD --build builds every user of the changed declarations, and tools/pr_overlap.py finds no overlap with open pull requests.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5294187191 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19451). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-13T10:51:14Z. --- ### What `sceVideodecMapMemory` now returns the argument errors firmware 13.42 returns before it calls into the decoder, and still throws after those checks. It gets the parameters the checks read: `(SceVideodec::Ctrl* ctrl, const void* memory)`. | Check, in the module's order | Error | |---|---| | `ctrl` or `memory` null | `0x80c1000f` | | `ctrl->thisSize` (64-bit) is not 24 | `0x80c10002` | | the 64-bit size at `memory+0` is not `0x20`, `0x28` or `0x48` | `0x80c10002` | | `ctrl->handle` (`ctrl+8`) is null | `0x80c10003` | | the size is `0x28` or `0x48` and the 32-bit field at `memory+0x20` is not 0 | `0x80c10000` | The one call on each failing path is the module's `printf` (PLT stub `0x1a20`, slot `0x8048`, imported as `hcuQgD53UxM`), which writes a `[%s@%04X%04X:%08llX]` debug line. That print is not reproduced: a title cannot observe it beyond debug output. Notes: - The memory-size check is `lea -0x20(%rcx),%rax; cmp $0x28,%rax; ja`, then `bt %rax` against `0x10000000101` (bits 0, 8 and 40), so exactly `0x20`, `0x28` and `0x48` pass. With `0x20` the module skips the `+0x20` field and goes straight to the decoder call. - The handle check tests the pointer stored in the control block (`mov 0x8(%rdi),%rax; test %rax,%rax`), not a lookup of a created decoder; the passing path calls the decoder's import (`0x1b10`, slot `0x80c0`) with the pointer stored at `handle+0x50` (`mov 0x50(%rax),%rdi`), and that path keeps throwing. - Each field is copied in with its own `GuestCopyIn_nid_no_patch` right before its check, in the module's order (only `ctrl+8` for the handle, and `memory+8` to `+0x23`, which the module reads before it tests `+0x20`). A field that cannot be read falls through to the throw, where the console would fault. The library's other exports answer an unreadable control or argument block with `0x80c1000f` (an unreadable frame buffer with `0x80c1000c`); that host-safety fallback is theirs and is not extended to this export. - The test is a new `testMapMemory` in the existing `core/libs/tests/GuestVideodec.cpp` (`guest_videodec`), called after the existing ones. The debt entry for `sceVideodecMapMemory` now says what still throws and that the print is not reproduced. No open pull request touches any of these files. ### Source Firmware 13.42 `system/common/lib/libSceVideodec.sprx` (sha256 `2f595fa415a77ff34e283d1cbd5bcd02331d856381579a98d20a7f5dac49468d`), read from disassembly, not run on a console. The entry (`kg+lH0V61hM`, `0xbd0`) comes from the module's dynamic symbol table; the PLT slots were named through the firmware test harness's relocation table (`review-tools/emu_sprx.py`). `0x1a30` (slot `0x8050`, `Ou3iL1abvng`) is the stack-protector failure path. <details><summary>Listing: sceVideodecMapMemory from its entry to its returns</summary> ``` bd0: 55 push %rbp bd1: 48 89 e5 mov %rsp,%rbp bd4: 53 push %rbx bd5: 48 83 ec 28 sub $0x28,%rsp bd9: 48 8b 1d 30 74 00 00 mov 0x7430(%rip),%rbx # 0x8010 be0: 48 85 ff test %rdi,%rdi be3: 0f 95 c2 setne %dl be6: 48 85 f6 test %rsi,%rsi be9: 0f 95 c1 setne %cl bec: 48 8b 03 mov (%rbx),%rax bef: 48 89 45 f0 mov %rax,-0x10(%rbp) bf3: 84 ca test %cl,%dl bf5: 0f 84 8a 00 00 00 je 0xc85 bfb: 48 83 3f 18 cmpq $0x18,(%rdi) bff: 0f 85 ac 00 00 00 jne 0xcb1 c05: 48 8b 0e mov (%rsi),%rcx c08: 48 8d 41 e0 lea -0x20(%rcx),%rax c0c: 48 83 f8 28 cmp $0x28,%rax c10: 0f 87 36 01 00 00 ja 0xd4c c16: 48 ba 01 01 00 00 00 01 00 00 movabs $0x10000000101,%rdx c20: 48 0f a3 c2 bt %rax,%rdx c24: 0f 83 22 01 00 00 jae 0xd4c c2a: 48 8b 47 08 mov 0x8(%rdi),%rax c2e: 48 85 c0 test %rax,%rax c31: 0f 84 a6 00 00 00 je 0xcdd c37: c4 e3 79 04 46 08 4e vpermilps $0x4e,0x8(%rsi),%xmm0 c3e: c5 f8 11 45 d0 vmovups %xmm0,-0x30(%rbp) c43: 48 8b 56 18 mov 0x18(%rsi),%rdx c47: 48 89 55 e0 mov %rdx,-0x20(%rbp) c4b: 48 83 f9 48 cmp $0x48,%rcx c4f: 74 0a je 0xc5b c51: 48 83 f9 28 cmp $0x28,%rcx c55: 0f 85 ab 00 00 00 jne 0xd06 c5b: 44 8b 46 20 mov 0x20(%rsi),%r8d c5f: 4d 85 c0 test %r8,%r8 c62: 0f 84 9e 00 00 00 je 0xd06 c68: 48 8d 3d 8b 36 00 00 lea 0x368b(%rip),%rdi # 0x42fa c6f: 48 8d 35 7b 36 00 00 lea 0x367b(%rip),%rsi # 0x42f1 c76: ba 1a a0 00 00 mov $0xa01a,%edx c7b: b9 fd 02 00 00 mov $0x2fd,%ecx c80: e9 b9 00 00 00 jmp 0xd3e c85: 48 8d 3d 6e 36 00 00 lea 0x366e(%rip),%rdi # 0x42fa c8c: 48 8d 35 5e 36 00 00 lea 0x365e(%rip),%rsi # 0x42f1 c93: ba 1a a0 00 00 mov $0xa01a,%edx c98: b9 dd 02 00 00 mov $0x2dd,%ecx c9d: 45 31 c0 xor %r8d,%r8d ca0: 31 c0 xor %eax,%eax ca2: e8 79 0d 00 00 call 0x1a20 ca7: b8 0f 00 c1 80 mov $0x80c1000f,%eax cac: e9 ba 00 00 00 jmp 0xd6b cb1: 48 8d 3d 42 36 00 00 lea 0x3642(%rip),%rdi # 0x42fa cb8: 48 8d 35 32 36 00 00 lea 0x3632(%rip),%rsi # 0x42f1 cbf: ba 1a a0 00 00 mov $0xa01a,%edx cc4: b9 e2 02 00 00 mov $0x2e2,%ecx cc9: 45 31 c0 xor %r8d,%r8d ccc: 31 c0 xor %eax,%eax cce: e8 4d 0d 00 00 call 0x1a20 cd3: b8 02 00 c1 80 mov $0x80c10002,%eax cd8: e9 8e 00 00 00 jmp 0xd6b cdd: 48 8d 3d 16 36 00 00 lea 0x3616(%rip),%rdi # 0x42fa ce4: 48 8d 35 06 36 00 00 lea 0x3606(%rip),%rsi # 0x42f1 ceb: ba 1a a0 00 00 mov $0xa01a,%edx cf0: b9 ee 02 00 00 mov $0x2ee,%ecx cf5: 45 31 c0 xor %r8d,%r8d cf8: 31 c0 xor %eax,%eax cfa: e8 21 0d 00 00 call 0x1a20 cff: b8 03 00 c1 80 mov $0x80c10003,%eax d04: eb 65 jmp 0xd6b d06: c7 45 e8 00 00 00 00 movl $0x0,-0x18(%rbp) d0d: 48 8d 75 d0 lea -0x30(%rbp),%rsi d11: ba 01 00 00 00 mov $0x1,%edx d16: 48 8b 78 50 mov 0x50(%rax),%rdi d1a: e8 f1 0d 00 00 call 0x1b10 d1f: 85 c0 test %eax,%eax d21: 74 46 je 0xd69 d23: 41 89 c0 mov %eax,%r8d d26: 48 8d 3d cd 35 00 00 lea 0x35cd(%rip),%rdi # 0x42fa d2d: 48 8d 35 bd 35 00 00 lea 0x35bd(%rip),%rsi # 0x42f1 d34: ba 1a a0 00 00 mov $0xa01a,%edx d39: b9 0b 03 00 00 mov $0x30b,%ecx d3e: 31 c0 xor %eax,%eax d40: e8 db 0c 00 00 call 0x1a20 d45: b8 00 00 c1 80 mov $0x80c10000,%eax d4a: eb 1f jmp 0xd6b d4c: 48 8d 3d a7 35 00 00 lea 0x35a7(%rip),%rdi # 0x42fa d53: 48 8d 35 97 35 00 00 lea 0x3597(%rip),%rsi # 0x42f1 d5a: ba 1a a0 00 00 mov $0xa01a,%edx d5f: b9 e9 02 00 00 mov $0x2e9,%ecx d64: e9 60 ff ff ff jmp 0xcc9 d69: 31 c0 xor %eax,%eax d6b: 48 8b 0b mov (%rbx),%rcx d6e: 48 3b 4d f0 cmp -0x10(%rbp),%rcx d72: 75 07 jne 0xd7b d74: 48 83 c4 28 add $0x28,%rsp d78: 5b pop %rbx d79: 5d pop %rbp d7a: c3 ret d7b: e8 b0 0c 00 00 call 0x1a30 d80: 0f 0b ud2 ``` </details> ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 11 Pro 10.0.26300, WinLibs GCC 15.2, Release, head `e454c627d5` (based on `main` `00b3b52a3e`). - `guest_videodec`: passes, none Not Run, with `libSceVideodec` and the test executable rebuilt. The new `testMapMemory` drives every error in the table above: both nulls; a control block size of 32; nine memory sizes around the accepted three (0, `0x18`, `0x1f`, `0x21`, `0x30`, `0x40`, `0x47`, `0x49`, `0x50`) with a null handle, so the size check is shown to come before the handle check; a null handle for each accepted size with a non-zero `+0x20` field, so the handle check is shown to come before that field; and three non-zero `+0x20` values for sizes `0x28` and `0x48`. It calls no passing path. - **Negative control:** at `ad644d076a`, a throwaway commit on `e454c627d5` that puts `main`'s throwing body back into `sceVideodecMapMemory` and keeps the test and the signature, `guest_videodec` fails with `sceVideodecMapMemory not implemented`. - `tools/check_conventions.py --base upstream/main` on the committed head: all checks pass. - `review-tools`' `sig_users.py HEAD --build`: builds every target that names the changed declaration. - `tools/pr_overlap.py --branch feat/videodec-mapmemory-checks --jobs 8` on the head: no overlap with open pull requests. - **Upkeep 2026-11-18:** merged `main` `648ba19b3e` into the branch as `e3e8172ed6`, with no conflicts. On that head: `tools/check_conventions.py --base upstream/main` passes, `guest_videodec`: 1 of 1 pass, none Not Run, `review-tools`' `sig_users.py HEAD --build` builds every user of the changed declarations, and `tools/pr_overlap.py` finds no overlap with open pull requests. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
PrivacyOnion commented 2026-11-15 21:00:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T21:00:10Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against e454c627d5:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: guest_videodec_tests built cleanly.
  • CTest (guest_videodec):
    1/1 Test #4449: guest_videodec ...................   Passed    0.38 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceVideodec/Export.cpp, core/libs/prx/libSceVideodec/include/Api.hpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified in core/libs/prx/libSceVideodec/Export.cpp that sceVideodecMapMemory matches PS5 firmware 13.42 disassembly: null pointers return VideodecErrorArgumentPointer (0x80C1000F), control block size mismatch != 24 returns VideodecErrorStructSize (0x80C10002), memory sizes other than 0x20, 0x28, and 0x48 return VideodecErrorStructSize (0x80C10002), null handle pointer at offset 0x8 returns VideodecErrorHandle (0x80C10003), and non-zero flags at offset 0x20 for sizes 0x28 and 0x48 return VideodecErrorApiFail (0x80C10000).
    • Verified memory bounds and copy offsets in core/libs/prx/libSceVideodec/Export.cpp: copying 0x1C bytes from memory + 0x8 safely reads up to offset 0x24 within the allocated memory block (size >= 0x28), size 0x20 correctly skips reading flags at 0x20, and std::memcpy safely extracts the uint32_t flags from fields + 0x18.
    • Verified declaration consistency between core/libs/prx/libSceVideodec/include/Api.hpp and core/libs/prx/libSceVideodec/Export.cpp, confirming extern "C" linkage, APS5_VABI calling convention, and SceVideodec::Ctrl parameter types.
    • Verified strict compliance with AGENTS.md rules: zero comments in code across Export.cpp, Api.hpp, and GuestVideodec.cpp; the unimplemented decoder path throws via NotImplemented_nid_no_patch(func); and known gaps are accurately documented in docs/dev/debt/libSceVideodec.md without adding extra files.
    • Audited core/libs/tests/GuestVideodec.cpp testMapMemory, confirming rigorous coverage of null control and memory pointers, wrong control size, nine boundary and invalid memory sizes, verification of size check precedence over handle check, handle check precedence over flags check, and multi-bit non-zero flag values across sizes 0x28 and 0x48.
    • Verified cross-platform 64-bit safety (Linux LP64 and Windows LLP64), confirming fixed-width std::uint64_t and std::uint32_t usage without narrowing conversions or signed/unsigned comparison warnings.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5912909736 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19451#pullrequestreview-5912909736). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-15T21:00:10Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `e454c627d5`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `guest_videodec_tests` built cleanly. - **CTest** (`guest_videodec`): ``` 1/1 Test #4449: guest_videodec ................... Passed 0.38 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceVideodec/Export.cpp`, `core/libs/prx/libSceVideodec/include/Api.hpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified in core/libs/prx/libSceVideodec/Export.cpp that sceVideodecMapMemory matches PS5 firmware 13.42 disassembly: null pointers return VideodecErrorArgumentPointer (0x80C1000F), control block size mismatch != 24 returns VideodecErrorStructSize (0x80C10002), memory sizes other than 0x20, 0x28, and 0x48 return VideodecErrorStructSize (0x80C10002), null handle pointer at offset 0x8 returns VideodecErrorHandle (0x80C10003), and non-zero flags at offset 0x20 for sizes 0x28 and 0x48 return VideodecErrorApiFail (0x80C10000). - Verified memory bounds and copy offsets in core/libs/prx/libSceVideodec/Export.cpp: copying 0x1C bytes from memory + 0x8 safely reads up to offset 0x24 within the allocated memory block (size >= 0x28), size 0x20 correctly skips reading flags at 0x20, and std::memcpy safely extracts the uint32_t flags from fields + 0x18. - Verified declaration consistency between core/libs/prx/libSceVideodec/include/Api.hpp and core/libs/prx/libSceVideodec/Export.cpp, confirming extern "C" linkage, APS5_VABI calling convention, and SceVideodec::Ctrl parameter types. - Verified strict compliance with AGENTS.md rules: zero comments in code across Export.cpp, Api.hpp, and GuestVideodec.cpp; the unimplemented decoder path throws via NotImplemented_nid_no_patch(__func__); and known gaps are accurately documented in docs/dev/debt/libSceVideodec.md without adding extra files. - Audited core/libs/tests/GuestVideodec.cpp testMapMemory, confirming rigorous coverage of null control and memory pointers, wrong control size, nine boundary and invalid memory sizes, verification of size check precedence over handle check, handle check precedence over flags check, and multi-bit non-zero flag values across sizes 0x28 and 0x48. - Verified cross-platform 64-bit safety (Linux LP64 and Windows LLP64), confirming fixed-width std::uint64_t and std::uint32_t usage without narrowing conversions or signed/unsigned comparison warnings. Looks Good To Me
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!19451
No description provided.