fix(libc): return 0 from the narrow ctype functions for values outside 0..255 #2698
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2698"
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-10T11:19:00Z.
What
isalpha,isdigit,isalnum,isspace,isupper,islower,isblank,iscntrl,isprint,isgraph,ispunct,isxdigit,toupperandtolowerthrewstd::invalid_argumentfor any argument outside EOF and 0..255, which terminates the process. A guest that passes a sign-extendedchar(for exampleisalpha(-23)for a byte 0xE9) aborted.FreeBSD's libc range-checks instead: the classifiers go through
__sbmaskrune/__isctypeininclude/_ctype.h(releng/11.4,mainidentical), which return 0 forc < 0orc >= __mb_sb_limit, andtoupper/tolower(__sbtoupper/__sbtolower) returncunchanged outside that range; the wide___runetype/___toupper/___tolowerinrunetype.cgive the same results. The guestisw*functions inRuneLocale.cppalready behave this way. The narrow functions now return 0 (classifiers) or the argument (toupper,tolower) for any value outside 0..255, including EOF. Results for 0..255 are unchanged. The assumption that the console's libc behaves like FreeBSD's here is recorded in TechnicalDebt.Tested
Windows 11 (10.0.26200), WinLibs GCC 15.2.0 r7, Release:
guest_charactergains -2, -23, -128, -129, 256, 257, 0x1e9, 0xffff, 0x10000, INT_MAX and INT_MIN for all 14 functions; it fails without the change (uncaught exception, exit0xc0000409) and passes with it.ctest -R "guest_character|guest_locale|guest_rune"passes.main; results are unchanged under host-locale and guestsetlocalechanges and with 8 threads.tools/check_conventions.py --base origin/mainpasses;tools/pr_overlap.py --branchreports no overlap.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-10T11:19:11Z.
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