NetBSD/usr.bin/mklocale
rin 1246b914bd mklocale(1): Add range check for TODIGIT, rather than disabling it
PR lib/57798

Digit value specified by TODIGIT is storaged as lowest 8 bits of
_RuneType, see lib/libc/locale/runetype_file.h:

https://nxr.netbsd.org/xref/src/lib/libc/locale/runetype_file.h#56

The symptom reported in the PR is due to missing range check for
this value; values of 256 and above were mistakenly treated as
other flag bits in _RuneType.

For example, U+5146 has numerical value 1000,000,000,000 ==
0xe8d4a51000 where __BITS(30, 31) == _RUNETYPE_SW3 are turned on.
This is why wcwidth(3) returned 3 for this character.

This apparently affected not only character width, but also other
attributes storaged in _RuneType.

IIUC, digit value attributes in _RuneType have never been utilized
until now, but preserve these if digit fits within (0, 256). This
should be safer for pulling this up into netbsd-10. Also, these
attributes may be useful to implement some I18N features as
suggested by uwe@ in the PR.

netbsd-[98] is not affected as these use old UTF-8 ctype definitions.
2024-01-05 02:38:06 +00:00
..
Makefile bsd.own.mk: rename GCC_NO_* to CC_WNO_* 2023-06-03 09:09:01 +00:00
ldef.h
lex.l
mklocale.1 mklocale(1): Add range check for TODIGIT, rather than disabling it 2024-01-05 02:38:06 +00:00
mklocaledb.c
yacc.y mklocale(1): Add range check for TODIGIT, rather than disabling it 2024-01-05 02:38:06 +00:00