glibc/iconv
Stefan Liebler 7ab1de2106 Fix UTF-16 surrogate handling. [BZ #19727]
According to the latest Unicode standard, a conversion from/to UTF-xx has
to report an error if the character value is in range of an utf16 surrogate
(0xd800..0xdfff). See https://sourceware.org/ml/libc-help/2015-12/msg00015.html.
Thus this patch fixes this behaviour for converting from utf32 to internal and
from internal to utf8.

Furthermore the conversion from utf16 to internal does not report an error if the
input-stream consists of two low-surrogate values. If an uint16_t value is in the
range of 0xd800 .. 0xdfff, the next uint16_t value is checked, if it is in the
range of a low surrogate (0xdc00 .. 0xdfff). Afterwards these two uint16_t
values are interpreted as a high- and low-surrogates pair. But there is no test
if the first uint16_t value is really in the range of a high-surrogate
(0xd800 .. 0xdbff). If there would be two uint16_t values in the range of a low
surrogate, then they will be treated as a valid high- and low-surrogates pair.
This patch adds this test.

This patch also adds a new testcase, which checks UTF conversions with input
values in range of UTF16 surrogates. The test converts from UTF-xx to INTERNAL,
INTERNAL to UTF-xx and directly between UTF-xx to UTF-yy. The latter conversion
is needed because s390 has iconv-modules, which converts from/to UTF in one step.
The new testcase was tested on a s390, power and intel machine.

ChangeLog:

	[BZ #19727]
	* iconvdata/utf-16.c (BODY): Report an error if first word is not a
	valid high surrogate.
	* iconvdata/utf-32.c (BODY): Report an error if the value is in range
	of an utf16 surrogate.
	* iconv/gconv_simple.c (BODY): Likewise.
	* iconvdata/bug-iconv12.c: New file.
	* iconvdata/Makefile (tests): Add bug-iconv12.

rename test
2016-05-25 17:18:06 +02:00
..
dummy-repertoire.c
gconv_builtin.c
gconv_builtin.h Fix min/max needed for ascii to INTERNAL conversion 2016-03-07 17:47:50 +01:00
gconv_cache.c
gconv_charset.h
gconv_close.c
gconv_conf.c
gconv_db.c
gconv_dl.c Fix build failures with -DDEBUG. 2016-01-15 11:07:41 -07:00
gconv_int.h
gconv_open.c
gconv_simple.c Fix UTF-16 surrogate handling. [BZ #19727] 2016-05-25 17:18:06 +02:00
gconv_trans.c
gconv.c
gconv.h
iconv_charmap.c
iconv_close.c
iconv_open.c
iconv_prog.c Update copyright dates not handled by scripts/update-copyrights. 2016-01-04 16:26:30 +00:00
iconv_prog.h
iconv.c
iconv.h
iconvconfig.c Update copyright dates not handled by scripts/update-copyrights. 2016-01-04 16:26:30 +00:00
iconvconfig.h
loop.c
Makefile Fix ucs4le_internal_loop in error case. [BZ #19726] 2016-05-25 17:18:06 +02:00
skeleton.c Fix build errors with -DNDEBUG. 2016-01-15 10:44:07 -07:00
strtab.c
tst-iconv1.c
tst-iconv2.c
tst-iconv3.c
tst-iconv4.c
tst-iconv5.c
tst-iconv6.c Fix ucs4le_internal_loop in error case. [BZ #19726] 2016-05-25 17:18:06 +02:00
Versions