#14730: towlower() and towupper() should check the character range when
gLocaleBackend is NULL.
--------------------------+------------------------------
Reporter: korli | Owner: nobody
Type: bug | Status: new
Priority: normal | Milestone: Unscheduled
Component: System/POSIX | Version: R1/Development
Keywords: | Blocked By:
Blocking: | Has a Patch: 0
Platform: All |
--------------------------+------------------------------
tolower and toupper are only valid for unsigned char types.
see https://github.com/haikuports/haikuports/issues/3410 for reference.
Something like this:
{{{
wint_t
towlower(wint_t wc)
{
if (gLocaleBackend == NULL) {
if (wc < 0 || wc > 127)
return 0;
return tolower(wc);
}
wint_t result = wc;
gLocaleBackend->ToWCTrans(wc, _ISlower, result);
return result;
}
wint_t
towupper(wint_t wc)
{
if (gLocaleBackend == NULL) {
if (wc < 0 || wc > 127)
return 0;
return toupper(wc);
}
wint_t result = wc;
gLocaleBackend->ToWCTrans(wc, _ISupper, result);
return result;
}
}}}
--
Ticket URL: <https://dev.haiku-os.org/ticket/14730>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.