docs(libc): correct the RSIZE_MAX that swprintf_s and vswprintf_s assume #9360
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9360"
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 thuanquang on 2026-10-21T19:20:32Z.
What
One statement in
docs/dev/debt/libc.mdno longer matchesmain; it is replaced with whatmaindoes now, and nothing else in the entry changes.RSIZE_MAXassumed to beSIZE_MAX >> 1:". vswprintf_s and swprintf_s defineRsizeMax = (SIZE_MAX >> 1) / sizeof(char16_t)(core/libs/prx/libc/src/FormattingWide.cpp:268 and :286) and use it for the size check and for clearing buffer[0]. Only snwprintf_s usesSIZE_MAX >> 1(:247). The code has used this limit sincea0bd257a09(#5454), the commit that also wrote the entry. Now: "follow C11 K.3.9.1.4 withRSIZE_MAXassumed to be(SIZE_MAX >> 1) / sizeof(char16_t):".Tested
Docs only; nothing was built or run. On origin/main
1698d1ea6aI read docs/dev/debt/libc.md and, under core/libs/prx/libc, SonyCrt.hpp (handler slot, SonyInvokeConstraintHandler, SonyFormatAsctime, SonyCtimeS, SonyAsctimeS, SonyWcscpyS), Strings.cpp memcpy_s, Formatting.cpp FormatSecure, the FormattingWide.cpp wide _s printf functions, Time.cpp ctime_s and asctime_s, and BoundsChecking.cpp violation(), and I grepped every SonyInvokeConstraintHandler and SonyConstraintHandlerSlot use under core/libs/prx. (main1896871ba7). Each statement was found by a read-only sweep of the debt files and confirmed by two independent verifier passes and a final check on currentmain. No open pull request edits these sentences (checked against every open PR's diff of this file).mainb930da950d(head5489f07047) for an adjacent-line conflict (#10312 added the strerror entry right after this one); the edited entry itself is unchanged onmain. Rechecked onb930da950d(no later change to the file):vswprintf_sandswprintf_sstill define the wide limit atFormattingWide.cpp:268and:286,snwprintf_skeepsSIZE_MAX >> 1at:247.python tools/check_conventions.py --base origin/mainwith this title and body passes.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