]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
lib/ucs2_string: Correct ucs2 -> utf8 conversion
authorJason Andryuk <jandryuk@gmail.com>
Fri, 12 Feb 2016 23:13:33 +0000 (23:13 +0000)
committerSasha Levin <sasha.levin@oracle.com>
Tue, 12 Apr 2016 02:44:23 +0000 (22:44 -0400)
commit2f53ace471375e60b3ba1b5341f673e8b36684aa
treee903a5dcc3883e371cd0963765ad8eb60e821340
parentcbf3d65e135a43cf654f10037eafe6f9be14baf5
lib/ucs2_string: Correct ucs2 -> utf8 conversion

[ Upstream commit a68075908a37850918ad96b056acc9ac4ce1bd90 ]

The comparisons should be >= since 0x800 and 0x80 require an additional bit
to store.

For the 3 byte case, the existing shift would drop off 2 more bits than
intended.

For the 2 byte case, there should be 5 bits bits in byte 1, and 6 bits in
byte 2.

Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Cc: Peter Jones <pjones@redhat.com>
Cc: Matthew Garrett <mjg59@coreos.com>
Cc: "Lee, Chun-Yi" <jlee@suse.com>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
lib/ucs2_string.c