fix(libc): reject an invalid _WStoul base like Dinkumware instead of … #10729
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10729"
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 dwk001 on 2026-10-24T19:51:40Z.
What
_WStoulthrewstd::invalid_argumentfor a base other than 0 or 2 to 36. It now passes every base towcstoul, which returns 0, stores the start of the string in the end pointer and leaveserrnounchanged, as Dinkumware'sxstoul.cdoes. Unverified on the console; noted indocs/dev/debt/libc.md.Tested
Linux, full build with
-DBUILD_TESTING=ON:ctest --test-dir build -R guest_wide_conversionpasses with cases for bases 1, 37 and -2.tools/check_conventions.py --base origin/mainreports one warning: the existing_WStoul/_Iswctype/swscanfdebt entry was already over the 1000-character limit on main.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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T21:46:56Z.
Review: APPROVED
Reviewed exact head
5d2b23c854. Removing the_WStoul-only exception preserves the sharedwcstoulparser behavior and thesetError=falseinvalid-base path: zero result, end pointer at the original input, and unchanged errno. The tests cover bases 1, 37, and -2 with leading whitespace. I syntax-compiled the exactStrings.cppandGuestWideConversion.cpp; conventions report 0 errors (one existing debt-length warning), andgit diff --checkpasses. I could not run the full runtime test in this environment.Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-10-28T15:53:12Z.
Review: APPROVED
Approving head
31cc00b5d8. I read the diff and ran firmware 13.42's_WStoul(JhVR7D4Ax6Y): the decrypted systemlibSceLibcInternal.sprx's export, natively on a PC (not a console), witherrnocleared and the end pointer pre-set before each call. Three identical runs." 1"with base 1, 37 and -2,"1"with base 1,"Z"with base 37 and" 1"with base 100 all return 0, leave the end pointer at the start of the string and leaveerrnoat 0. That is what the newCheckStoulrows require." 1"base 10 gives 1 (end after 2 characters)," ff"base 16 gives 255,"0x1f"base 0 gives 31,"zz"base 36 gives 1295, and an overflowing decimal givesULLONG_MAXwitherrno34, so the end pointer anderrnoare both observed.So the debt entry's "unverified on the console" can say that firmware 13.42's system module does the same, if you want to cite it.