buf in libc/locale/utf8.c: typo->not quite one-to-one
Rich Felker
dalias at aerifal.cx
Wed Mar 29 16:31:31 UTC 2006
i'm not a freebsd user and haven't run any tests on this, but while
reading the freebsd libc sources i found what appears to be a typo in
utf8.c's mbrtowc implementation. for 6-byte sequences, the top 6 bits
are compared against 111111 rather than the top 7 bits being compared
against 1111110. this results in the illegal bytes fe and ff being
treated the same as the legal bytes fc and fd.
the fix is (sorry for my lame inline handmade patch):
- } else if ((ch & 0xfc) == 0xfc) {
+ } else if ((ch & 0xfe) == 0xfc) {
rich
More information about the freebsd-bugbusters
mailing list