fix(libSceLibreSsl): reject null strings in the ASN.1 accessors as invalid arguments #11111
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11111"
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 mantavisual on 2026-10-25T18:11:20Z.
What
ASN1_STRING_data,ASN1_STRING_lengthandASN1_STRING_typeare implemented, but each throwsNotImplemented_nid_no_patchfor a null string, so they are still counted as stubs. That behaviour is known rather than unimplemented: LibreSSL 2.5.4's asn1_lib.c, the version thedocs/dev/debt/libSceLibreSsl.mdASN.1 entry follows, returnsx->length,x->typeandx->datawithout a check, so a null string faults.This changes the three null checks to
APS5_INVALID_ARG_EX, as the DES functions in this library already do where LibreSSL faults (Null pointers throw where LibreSSL faultsin the same debt file). They still throw for null, and the debt entry's "Null accessor inputs ... throw where the source has undefined behaviour" stays accurate, so the debt file is unchanged. Non-null behaviour is unchanged.ASN1_INTEGER_getis left as it is. Its remaining throw covers magnitudes beyond the signed 64-bit range, where 2.5.4's signed shift and negation are undefined behaviour, not a null input.Tested
Windows 11 Pro 23H2, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON, onmainac65cf490e.guest_libressl_asn1: the three null-input checks now requirestd::invalid_argument, not any exception. Onmainthey get thestd::runtime_errorfromNotImplemented_nid_no_patch, so the new check fails there and passes here. The existing non-null accessor checks are unchanged and pass.ctest -R "guest_libressl|patched_libraries": 11 of 11 pass, after rebuilding every LibreSSL and LibreSSL3 test target and the NID-patchedlibSceLibreSsl.prx.tools/progress.py --module libSceLibreSsl: 48 → 51 implemented, 351 → 348 stubs.tools/check_test_registration.py build: 1353 test executables, none built and not run.python3 tools/check_conventions.py --base origin/mainpasses. Overlap: no open PR changes these three functions (checked 2026-10-25 against the heads of the 54 open PRs that mention LibreSSL or OpenSSL). #11050 editsASN1_STRING_to_UTF8in the same file, in different hunks.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T18:13:13Z.
Review: APPROVED
Reviewed exact head . The three accessor changes match the pinned LibreSSL 2.5.4 source, whose accessors dereference the supplied without null guards. The focused tests now check the intended exception type while preserving the non-null accessor behavior. Eligibility, conventions, intake, labels and report checks pass; product/relinker jobs were skipped by path policy, so I rely on the reported local Windows target runs for those tests.