Date: Wed, 29 Mar 2006 11:38:58 -0500 From: Rich Felker <dalias@aerifal.cx> To: bugbusters@freebsd.org Subject: buf in libc/locale/utf8.c: typo->not quite one-to-one Message-ID: <20060329163858.GA32369@brightrain.aerifal.cx>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060329163858.GA32369>
