summaryrefslogtreecommitdiff
path: root/lib/uniconv
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2016-11-17 11:51:55 +0100
committerBruno Haible <bruno@clisp.org>2016-11-19 14:11:31 +0100
commita24dbc4ae176ba52547256c636c15c81de17a9ee (patch)
tree6eaa00b1535d75ee2a3f216ce66733ebdebb0c35 /lib/uniconv
parent2c1432894869a0fd6dbe0202a168388dc26f982b (diff)
downloadgnulib-a24dbc4ae176ba52547256c636c15c81de17a9ee.tar.gz
Enable Unicode decoder safety unconditionally.
* lib/unistr.in.h (u32_mbtouc_unsafe): Assume CONFIG_UNICODE_SAFETY. * lib/unistr/u8-mblen.c (u8_mblen): Likewise. * lib/unistr/u8-mbtouc-unsafe.c (u8_mbtouc_unsafe): Likewise. * lib/unistr/u8-mbtouc-unsafe-aux.c (u8_mbtouc_unsafe_aux): Likewise. * lib/unistr/u8-prev.c (u8_prev): Likewise. * lib/unistr/u8-strmblen.c (u8_strmblen): Likewise. * lib/unistr/u8-strmbtouc.c (u8_strmbtouc): Likewise. * lib/unistr/u16-mblen.c (u16_mblen): Likewise. * lib/unistr/u16-mbtouc-unsafe.c (u16_mbtouc_unsafe): Likewise. * lib/unistr/u16-mbtouc-unsafe-aux.c (u16_mbtouc_unsafe_aux): Likewise. * lib/unistr/u16-prev.c (u16_prev): Likewise. * lib/unistr/u16-strmblen.c (u16_strmblen): Likewise. * lib/unistr/u16-strmbtouc.c (u16_strmbtouc): Likewise. * lib/unistr/u32-mblen.c (u32_mblen): Likewise. * lib/unistr/u32-mbtouc-unsafe.c (u32_mbtouc_unsafe): Likewise. * lib/unistr/u32-prev.c (u32_prev): Likewise. * lib/unistr/u32-next.c (u32_next): Likewise. * lib/unistr/u32-strmblen.c (u32_strmblen): Likewise. * lib/unistr/u32-strmbtouc.c (u32_strmbtouc): Likewise. * lib/uniconv/u8-conv-to-enc.c (u8_conv_to_encoding): Likewise. * lib/uniconv/u8-strconv-to-enc.c (u8_strconv_to_encoding): Likewise. * tests/unistr/test-u16-prev.c (check_invalid): Enable the CONFIG_UNICODE_SAFETY tests unconditionally. * tests/unistr/test-u32-mblen.c (main): Likewise. * tests/unistr/test-u32-mbtouc.h (test_function): Likewise. * tests/unistr/test-u32-prev.c (check_invalid): Likewise. * tests/unistr/test-u32-next.c (main): Likewise. * tests/unistr/test-u32-strmblen.c (main): Likewise. * tests/unistr/test-u32-strmbtouc.c (main): Likewise. * tests/unistr/test-u32-mbtouc.c (FULL_SAFETY): Remove macro. * lib/unistr/u8-check.c (u8_check): Remove old dead code. * lib/unistr/u8-mbtouc.c (u8_mbtouc): Likewise. * lib/unistr/u8-mbtouc-aux.c (u8_mbtouc_aux): Likewise. * lib/unistr/u8-mbtoucr.c (u8_mbtoucr): Likewise. * lib/unistr/u8-uctomb.c (u8_uctomb): Likewise. * lib/unistr/u8-uctomb-aux.c (u8_uctomb_aux): Likewise. * lib/unistr/u16-check.c (u16_check): Update comment. * NEWS: Mention the changes that callers should be aware of.
Diffstat (limited to 'lib/uniconv')
-rw-r--r--lib/uniconv/u8-conv-to-enc.c2
-rw-r--r--lib/uniconv/u8-strconv-to-enc.c2
2 files changed, 0 insertions, 4 deletions
diff --git a/lib/uniconv/u8-conv-to-enc.c b/lib/uniconv/u8-conv-to-enc.c
index 1057de70f3..bfd42b1ec8 100644
--- a/lib/uniconv/u8-conv-to-enc.c
+++ b/lib/uniconv/u8-conv-to-enc.c
@@ -41,13 +41,11 @@ u8_conv_to_encoding (const char *tocode,
char *result;
/* Conversion from UTF-8 to UTF-8. No need to go through iconv(). */
-#if CONFIG_UNICODE_SAFETY
if (u8_check (src, srclen))
{
errno = EILSEQ;
return NULL;
}
-#endif
/* Memory allocation. */
if (resultbuf != NULL && *lengthp >= srclen)
diff --git a/lib/uniconv/u8-strconv-to-enc.c b/lib/uniconv/u8-strconv-to-enc.c
index e2c3660fe4..5380306126 100644
--- a/lib/uniconv/u8-strconv-to-enc.c
+++ b/lib/uniconv/u8-strconv-to-enc.c
@@ -41,13 +41,11 @@ u8_strconv_to_encoding (const uint8_t *string,
{
/* Conversion from UTF-8 to UTF-8. No need to go through iconv(). */
length = u8_strlen (string) + 1;
-#if CONFIG_UNICODE_SAFETY
if (u8_check (string, length))
{
errno = EILSEQ;
return NULL;
}
-#endif
result = (char *) malloc (length);
if (result == NULL)
{