diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-11-29 01:56:06 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-11-29 01:56:06 +0000 |
commit | e6260d8928af77a2e003689db07d56aaad008b0b (patch) | |
tree | f7a6e9485e2f70feb13e54ed3074413bd5504a92 /libcpp/charset.c | |
parent | 5c646b1e993d280aa5f99c17626e46daa4cf64fb (diff) | |
download | gcc-e6260d8928af77a2e003689db07d56aaad008b0b.tar.gz |
Fix off-by-one bug in utf16 conversion (PR preprocessor/41698).
libcpp:
2014-11-29 John Schmerge <jbschmerge@gmail.com>
PR preprocessor/41698
* charset.c (one_utf8_to_utf16): Do not produce surrogate pairs
for 0xffff.
gcc/testsuite:
2014-11-29 Joseph Myers <joseph@codesourcery.com>
PR preprocessor/41698
* gcc/testsuite/g++.dg/cpp/utf16-pr41698-1.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218179 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp/charset.c')
-rw-r--r-- | libcpp/charset.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libcpp/charset.c b/libcpp/charset.c index 1064f527633..a34dafbb194 100644 --- a/libcpp/charset.c +++ b/libcpp/charset.c @@ -353,7 +353,7 @@ one_utf8_to_utf16 (iconv_t bigend, const uchar **inbufp, size_t *inbytesleftp, return EILSEQ; } - if (s < 0xFFFF) + if (s <= 0xFFFF) { if (*outbytesleftp < 2) { |