revert: copy IntegerDecoder and EC ASN.1 guest pointers safely (#22286, #22283) #22388

Merged
oneandonlydean merged 2 commits from upstream-pr/22388 into main 2026-11-17 16:47:11 +00:00
oneandonlydean commented 2026-11-17 13:50:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-11-17T13:50:28Z.


What

Exact inverse reverts of #22286 (merge 74e3a52519) and #22283 (merge fc77f60c09), one commit each. Since the LibreSsl3 guest pointer PRs landed within a few minutes of each other, guest_libressl3_asn1 and guest_libressl3_ec_parameters fail on Windows main, on plain main as well.

With #22286 (IntegerDecoder.cpp) reverted, guest_libressl3_asn1 passes on Windows and guest_libressl3_ec_parameters still fails (0xc0000409, requirement failed at line 195). #22283 is the only change to EcAsn1.cpp since that test last passed, so it is reverted here too. The guest pointer copies can come back once both tests pass on Windows with them.

Tested

The full Windows suite on this PR must show guest_libressl3_asn1 and guest_libressl3_ec_parameters passing.

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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5358098855 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22388). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-11-17T13:50:28Z. --- ### What Exact inverse reverts of #22286 (merge 74e3a52519) and #22283 (merge fc77f60c09), one commit each. Since the LibreSsl3 guest pointer PRs landed within a few minutes of each other, `guest_libressl3_asn1` and `guest_libressl3_ec_parameters` fail on Windows main, on plain main as well. With #22286 (`IntegerDecoder.cpp`) reverted, `guest_libressl3_asn1` passes on Windows and `guest_libressl3_ec_parameters` still fails (0xc0000409, requirement failed at line 195). #22283 is the only change to `EcAsn1.cpp` since that test last passed, so it is reverted here too. The guest pointer copies can come back once both tests pass on Windows with them. ### Tested The full Windows suite on this PR must show `guest_libressl3_asn1` and `guest_libressl3_ec_parameters` passing. ### Checklist - [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
MarcZX10 commented 2026-11-17 16:39:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T16:39:29Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

This is a revert of two earlier guest-pointer changes, reviewed at head ce30efdee25a. The diff is limited to EcAsn1.cpp and IntegerDecoder.cpp.

What I ran

  • Head reviewed: ce30efdee25aaf5f154d66dca0f84bf619a6be23, base main.
  • Read the description, the commit list, the manifest, the file list and the diff.
  • Repository reader (repo_read.py): searched for guest-copy helper use in core/libs/prx and for leftover includes and guest names in the two changed files.
  • Grep over the head copies of both changed files for std::vector, std::string, errno, GuestPtr, GuestBytes and GuestCopy.
  • No build and no tests were run.

Results

Check Result Note
Removed includes still needed passed No remaining uses of the removed headers
Guest copy helper definition not run Search did not return its definition
Windows suite (both LibreSsl3 tests) not run Author-reported only

Findings

Blocking

None.

Non-blocking

  • IntegerDecoder.cpp:163-166 and IntegerDecoder.cpp:217-218 write and read guest pointers directly (*tagClass, *tag, *length, *input, *output). The same applies to EcAsn1.cpp:375-376, EcAsn1.cpp:396 and EcAsn1.cpp:401-402, and to the o2i_ECPublicKey_nid_postfix block (changed lines 421-431). The error branches for unreadable and unwritable guest pointers are gone. Most other guest accesses in core/libs/prx go through GuestCopyIn_nid_no_patch, so this is a departure from that convention. Whether a bad guest pointer now faults rather than throwing depends on the guest memory model, which I did not confirm. The description says the copies are meant to come back once both tests pass, so this reads as a deliberate, temporary step.

Not verified

  • The two Windows tests named in the description (guest_libressl3_asn1, guest_libressl3_ec_parameters) were not run here. The result is only what the author reports.
  • The description calls this an exact inverse of #22286 and #22283. I could not check that against history from here.
  • The guest memory model: the search for the copy helper's definition returned nothing, so whether direct dereference is safe on the target is not confirmed.
  • Files read: the changed hunks in diff.patch for both files, plus grep over the head copies in files/. I did not read either full file.
  • o2i_ECPublicKey_nid_postfix still reads (*in)[0] before checking length. The old code had the same pattern, so this is not a regression.

To get this to a good state

Nothing is required by this review. The PR's own condition, that both Windows tests pass on this head, is not checked here.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5942587322 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22388#pullrequestreview-5942587322). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-17T16:39:29Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this; the points below are optional. This is a revert of two earlier guest-pointer changes, reviewed at head `ce30efdee25a`. The diff is limited to `EcAsn1.cpp` and `IntegerDecoder.cpp`. ## What I ran - Head reviewed: `ce30efdee25aaf5f154d66dca0f84bf619a6be23`, base `main`. - Read the description, the commit list, the manifest, the file list and the diff. - Repository reader (`repo_read.py`): searched for guest-copy helper use in `core/libs/prx` and for leftover includes and guest names in the two changed files. - Grep over the head copies of both changed files for `std::vector`, `std::string`, `errno`, `GuestPtr`, `GuestBytes` and `GuestCopy`. - No build and no tests were run. ## Results | Check | Result | Note | | --- | --- | --- | | Removed includes still needed | passed | No remaining uses of the removed headers | | Guest copy helper definition | not run | Search did not return its definition | | Windows suite (both LibreSsl3 tests) | not run | Author-reported only | ## Findings **Blocking** None. **Non-blocking** - `IntegerDecoder.cpp:163-166` and `IntegerDecoder.cpp:217-218` write and read guest pointers directly (`*tagClass`, `*tag`, `*length`, `*input`, `*output`). The same applies to `EcAsn1.cpp:375-376`, `EcAsn1.cpp:396` and `EcAsn1.cpp:401-402`, and to the `o2i_ECPublicKey_nid_postfix` block (changed lines 421-431). The error branches for unreadable and unwritable guest pointers are gone. Most other guest accesses in `core/libs/prx` go through `GuestCopyIn_nid_no_patch`, so this is a departure from that convention. Whether a bad guest pointer now faults rather than throwing depends on the guest memory model, which I did not confirm. The description says the copies are meant to come back once both tests pass, so this reads as a deliberate, temporary step. ## Not verified - The two Windows tests named in the description (`guest_libressl3_asn1`, `guest_libressl3_ec_parameters`) were not run here. The result is only what the author reports. - The description calls this an exact inverse of #22286 and #22283. I could not check that against history from here. - The guest memory model: the search for the copy helper's definition returned nothing, so whether direct dereference is safe on the target is not confirmed. - Files read: the changed hunks in `diff.patch` for both files, plus grep over the head copies in `files/`. I did not read either full file. - `o2i_ECPublicKey_nid_postfix` still reads `(*in)[0]` before checking `length`. The old code had the same pattern, so this is not a regression. ## To get this to a good state Nothing is required by this review. The PR's own condition, that both Windows tests pass on this head, is not checked here.
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!22388
No description provided.