mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
In legacy CJK locales a single input byte can decode to a wide character above UCHAR_MAX, e.g. SHIFT-JIS bytes 0xA1..0xDF become U+FF61..U+FF9F. wc then indexed its 256-entry wc_isprint/wc_isspace tables with that value and read past their end. * src/wc.c (wc): Take the byte-indexed fast path only when the decoded character fits in a byte; wider values fall through to c32width and c32isspace. * tests/wc/wc-sjis.sh: New test. * tests/local.mk (all_tests): Add it. * NEWS: Mention the fix. Link: https://github.com/coreutils/coreutils/pull/298