feat(libc): implement bounded decimal parsing with strtonum #8037
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8037"
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 MarrasFederico on 2026-10-19T18:23:08Z.
What
Add the missing
strtonumexport (XrIfmNFHL4I) to libc. Parse decimal signed 64-bit values within inclusive caller bounds, returninvalid,too smallortoo largeon failure, and preserve the caller's errno on success. Malformed input takes precedence over overflow, and reversed bounds are rejected before parsing.The signature and behavior follow FreeBSD 11.4 strtonum.c. The name/NID pair is present in the pinned symbol database. Console behavior remains unverified and is recorded in libc technical debt.
No matching open or closed PR, issue, or
origin/mainsymbol-history change was found.pr_overlap.pyreported no direct overlaps. Its not-compared shared files were reviewed manually: #5021, #5303, #6226, #6469, #6819, #7081, #7332, #7386, #7417, #7473, #7525 and #7715 change unrelated libc debt entries; #6044 only renamesGuestStrings.cppintotests/runtime/with zero content changes. None implements or testsstrtonum.Tested
Ubuntu 26.04 x86-64, GCC 15.2.0, Release,
BUILD_TESTING=ON:-j12.strtonum_nid_postfixis absent.guest_strings,guest_wide_strings,guest_errors,guest_safe_errorsandguest_allocating_stringspass.guest_strings: reversed-bound validation, trailing-character rejection, signed underflow, signed overflow, successful errno preservation, successful error-pointer clearing, and failure errno assignment.XrIfmNFHL4I.No title, console, Windows or macOS execution was tested. No performance claim.
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 github-actions[bot] on 2026-10-19T18:23:55Z.
Progress report (
98db779→20f75e9)📈 System libraries: 66.63% (+0.01%, +1 implemented functions)
✅ 1 implemented
strtonum_nid_postfixImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T18:39:33Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)docs/dev/debt/libc.mdL4-5Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
docs/dev/debt/libc.mddocs/dev/debt/libc.mdcore/libs/tests/GuestStrings.cppdocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mdImported from boykopovar/AnyPS5. Originally posted by wachi35676 on 2026-10-19T22:29:57Z.
Windows run (the description has Linux only): Windows 11 Home 26300, Ryzen 5 9600X, WinLibs GCC 15.2.0, Release, BUILD_TESTING=ON. This PR merged onto
main9127ea36d.guest_stringspasses 3/3, including the errno-preservation checks through__error_nid_postfix, so the hosterrnothe function sets is the one the guest reads on MinGW too.StringExtensions.cppfrommainthe test doesn't link, as on Linux.minval > maxvalcheck first, thenstrtollbase 10, the INVALID / TOOSMALL / TOOLARGE order,*errstrpset even on success, anderrnorestored on success.strtonumhashes toXrIfmNFHL4I.AI-assisted: yes (Claude Code); results above were run on this machine.