fix(libc): check sprintf_s and vsprintf_s as titles' libc.prx does #12622
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12622"
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 JJenkx on 2026-10-28T23:13:14Z.
What
sprintf_sandvsprintf_scurrently truncate output that does not fit and omit constraint-handler calls. This validates the destination and format, then applies the previously measured rules from thelibc.prxshipped by PPSA07923 and PPSA05916:SonyRsizeMaxreturns 0 without writing and reports<name>: bad argument.<name>: bad format argument.size - 1prefix, clears its first byte, returns 0 and reports<name>: buffer overflowwithERANGE.%nand a null%sreport the secure-conversion error and return 0. If preceding text already filled the buffer, overflow is reported afterward as well.The Windows wrappers move next to
snprintf_sso both platforms use the sameFormatTerminated. The existing secure conversion parser supplies the conversions; the branch is one topic commit on main. Main's scanner,snprintf_simplementation and its existing tests are preserved. The debt update uses a fragment.guest_sprintf_s_constraintsselects the terminated-output cases independently of the rest of the formatting suite. This makes the new behavior directly testable with unchanged main production code.Tested
Linux x86-64, GCC 16.2.1, CMake/Ninja Release. Candidate
c5b8c8f8fe40721ec724fa1bd49eb277e3077340, basee8b9749c0bea648e02e57f6530378dce5d1113ac; no merge commits.guest_formattingand the isolatedguest_sprintf_s_constraintsfail as expectedNo skipped or missing executables. The fixtures link
core/libs/libs/unpatched/libc.prx. The actual libc and fixture binaries were rebuilt, their hashes remained unchanged through each test arm, and the mutable build checkout was restored after every arm. The seven existing suites cover formatting, scan counts, wide stream scanning, wide formatting, CRT, variadic stdio and strings. The two negative-control failures detect the terminated-output behavior rather than depending on #9087.Conventions and debt-fragment checks pass; the
origin/maincheck reports zero errors with inherited long-debt warnings. A separate latest-main merge preview is attached with exact pins; that preview tree was not executed. No new Windows, title, console or performance result is claimed. Prior native reference measurements retain their historical pins in the archived previous description.Exact pins, full build/test logs, JUnit, binary hashes, source patch, preservation checks and historical description, SHA-256
631ec1b7022a0c74f0f0d525dc519b2f179d0b5eb9ef1ce9aae6c2caf416f220.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)