fix(libc): return 64-bit values from _Stoul on Windows #2442
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2442"
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 SurajKhanna on 2026-10-09T20:34:45Z.
What
_Stoul_nid_postfixinRuntimeSupport.cppwas declared returningunsigned longand delegating tostd::strtoul. On the PS5 (LP64),unsigned longis 64-bit, but on Windows (LLP64),unsigned longandstd::strtoulare 32-bit. On Windows host builds, inputs exceedingUINT32_MAX(4294967295) were clamped toUINT32_MAXand seterrnotoERANGE(34), which causes gueststd::stoulcalls to throwstd::out_of_rangeon values the console accepts.Fixes this by:
_Stoul_nid_postfixreturn type tostd::uint64_tand delegating tostd::strtoull(matchingstrtoul_nid_postfixinStrings.cpp).GuestMath.cppverifying parsing of 64-bit values (4294967296and18446744073709551615) without truncation or settingERANGE.Fixes #2424.
Tested
Windows 11, GCC 16.2.0 (UCRT64):
_Stoul_nid_postfixparses 64-bit values up toUINT64_MAXwithout settingERANGE.guest_math_tests).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 repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T20:51:14Z.
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.
Imported from boykopovar/AnyPS5. Originally posted by nauroth on 2026-10-09T21:41:05Z.
Thanks @SurajKhanna, the fix was right and the intake pause was just unlucky timing. Rather than let it sit, I've carried it into #1459, which already changes the same function: same
std::uint64_t+std::strtoull, and your twoguest_mathcases exactly as you wrote them, with you credited in the commit message. Thanks also to @MarcZX100 for pointing me to it and @AchrafReyani for the report in #2424.Pull request closed