summaryrefslogtreecommitdiff
path: root/iconvdata/utf-16.c
diff options
context:
space:
mode:
Diffstat (limited to 'iconvdata/utf-16.c')
-rw-r--r--iconvdata/utf-16.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/iconvdata/utf-16.c b/iconvdata/utf-16.c
index 2d74a1356e..ed5f5b2f1f 100644
--- a/iconvdata/utf-16.c
+++ b/iconvdata/utf-16.c
@@ -1,5 +1,5 @@
/* Conversion module for UTF-16.
- Copyright (C) 1999-2016 Free Software Foundation, Inc.
+ Copyright (C) 1999-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
@@ -295,6 +295,12 @@ gconv_end (struct __gconv_step *data)
{ \
uint16_t u2; \
\
+ if (__glibc_unlikely (u1 >= 0xdc00)) \
+ { \
+ /* This is no valid first word for a surrogate. */ \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
+ } \
+ \
/* It's a surrogate character. At least the first word says \
it is. */ \
if (__glibc_unlikely (inptr + 4 > inend)) \
@@ -329,6 +335,12 @@ gconv_end (struct __gconv_step *data)
} \
else \
{ \
+ if (__glibc_unlikely (u1 >= 0xdc00)) \
+ { \
+ /* This is no valid first word for a surrogate. */ \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
+ } \
+ \
/* It's a surrogate character. At least the first word says \
it is. */ \
if (__glibc_unlikely (inptr + 4 > inend)) \