fix(libc): stop strto* at the x of a bare 0x prefix on Windows #2676
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2676"
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 husseinkad on 2026-10-10T10:44:31Z.
What
On Windows the host
strtoll/strtoullleaveendptrat the start of the string for a0x(or0X) that is not followed by a hex digit, in bases 0 and 16:strtol("0x", &e, 0),strtoul("0x", &e, 16),strtol(" -0x!", &e, 16)all report that nothing was converted. C17 7.22.1.4p4 makes the subject sequence"0", so the value is 0 andendptrmust point at thex; FreeBSD's libc does the same. The guest already guards the analogous0bcase (StopAtBinaryPrefix_nid_no_patch).The guard now also stops at a
0x/0Xwith no hex digit after it (bases 0 and 16), and is renamedStopAtRadixPrefix_nid_no_patchbecause it is no longer binary-only (_nid_no_patchhelpers are not exports). Everything routed through it is covered:strtol,strtoul,strtoll,strtoull,strtoimax,strtoumax,_Stoul,_Stoulland thewcsto*variants. Behaviour for every other input is unchanged.Tested
Windows 11 (10.0.26200), WinLibs GCC 15.2.0 r7, Release:
guest_math,guest_wide_strings,guest_wide_formatting,guest_strings,guest_scan_count: all pass. The new rows (signed, unsigned, imax and_Stoulvariants inGuestMath.cpp; wide variants inGuestWideStrings.cpp) makeguest_mathandguest_wide_stringsfail without the change.Strings.cppand thestrtoimax/strtoumax/_Stoulwrappers compiled against an independent implementation of C17 7.22.1.4, over every string of length 0 to 6 from a 15-character alphabet, bases {0, 2, 8, 10, 16, 36}, all 12 exports (value,endptr, errno): 0 divergences from the reference and 0 regressions againstmain;maindiverges on about 1.26 million of those cases and the branch on none.tools/check_conventions.py --base origin/mainpasses;tools/pr_overlap.py --branchreports no overlap.x).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T10:45:23Z.
Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.
Pull request closed