fix(libc): preserve unsigned overflow saturation on Windows #20395
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/20395"
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 IvanFogel on 2026-11-15T04:33:09Z.
What
Negative unsigned overflow in the observed Wine host CRT returns the negated saturation value (
1) while reportingERANGE, breaking existing guest integer and ICU parsing checks. Normalize Windows unsignedParseIntegerresults to the destination maximum on a newly raised range error, and preserve incoming errors on successful conversions. The same helper serves narrow, wide and Dinkumware callers.Tested
Additional review investigation, 2026-11-15 — published head remains
26e33a85262270bbeb619cc7f45edbb31ee84dc8. All six cases reported by the reviewer pass on both the exact original baseecd019f60180f2a0bfa0a0038743b1ffaa35ce15and this head, under both CachyOS/GCC 16.2.1 and an isolated Ubuntu 24.04.5/GCC 13.3.0-6ubuntu2~24.04.1 userland: 24/24 executions, no skips, includingguest_math_exact. These are controlled base/head runs; the earlier 50-case native qualification did not include that test.The Ubuntu sandbox shares the CachyOS host kernel, so this does not reproduce the reviewer's complete machine. No production cause or corrective source change is established. The test prints an assertion source location before aborting; the report lacks that stderr, exact build flags/CMakeCache and kernel details. Math implementation/test/registration are unchanged from the original base, and the new parser execution is Windows-guarded; header rebuild effects were included in the fresh real builds. The original reviewer subsequently approved this unchanged head on 2026-11-16 (approval). That review's negative-control prose conflicts with its pasted all-pass output, so it is not additional negative-control evidence; the independently reproduced controls below retain their exact pins.
Exact GCC13/GCC16 base/head logs, compiler/image provenance and source triage. Current-main behavior, native Windows and the reviewer's complete environment are separate from these runs.
Exact head
26e33a85262270bbeb619cc7f45edbb31ee84dc8, based on mainecd019f60180f2a0bfa0a0038743b1ffaa35ce15:dc03f2b2b8494885dcde82bd3547fde8dbfe8bf4fails all four parsing caller suites at the intended negative-overflow assertions. A standalone host-only probe reproduces the runtime result without AnyPS5. Added coverage checks aliases, nondecimal overflow, end pointers, error outputs and valid/no-conversion calls with incomingERANGE.No native Windows, macOS, console/title or performance result is claimed.
Full exact-head logs, contracts, RED/GREEN and overlap review.
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 PrivacyOnion on 2026-11-15T04:48:25Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
26e33a8526:tools/check_conventions.pypassed;git diff --checkclean.guest_dinkumware_internals_tests,guest_icu_cstring_tests,guest_math_tests,guest_wide_string_testsbuilt cleanly.guest_wide_strings,guest_math,guest_math_elementary,guest_math_exact,guest_dinkumware_internals,guest_icu_cstring):Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-15T05:29:13Z.
Review: APPROVED
Reviewed — looks good
The unsigned parser normalization is confined to Windows and preserves the saved error on successful conversion; the inspected changes support merging at head
26e33a85262270bbeb619cc7f45edbb31ee84dc8.What I ran
No tests or build commands were run. I read the prepared diff and all five changed files listed in the manifest.
Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Build and test results, native Windows behavior, macOS, console/title behavior, and performance were not independently verified.
review/files.jsonwas unavailable; the manifest lists five files, all included in the prepared folder and read.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-16T00:38:31Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
26e33a8526:tools/check_conventions.pypassed;git diff --checkclean.guest_dinkumware_internals_tests,guest_icu_cstring_tests,guest_math_tests,guest_wide_string_testsbuilt cleanly.guest_wide_strings,guest_math,guest_dinkumware_internals,guest_icu_cstring):core/libs/prx/libc/include/SonyCrt.hppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me