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. From-SVN: r218179
This commit is contained in:
parent
bfa52c5720
commit
81fee4a708
@ -1,3 +1,8 @@
|
||||
2014-11-29 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
PR preprocessor/41698
|
||||
* gcc/testsuite/g++.dg/cpp/utf16-pr41698-1.C: New test.
|
||||
|
||||
2014-11-28 Vladimir Makarov <vmakarov@redhat.com>
|
||||
|
||||
PR target/64061
|
||||
|
15
gcc/testsuite/g++.dg/cpp/utf16-pr41698-1.C
Normal file
15
gcc/testsuite/g++.dg/cpp/utf16-pr41698-1.C
Normal file
@ -0,0 +1,15 @@
|
||||
// PR 41698: off-by-one error in UTF-16 encoding.
|
||||
|
||||
// { dg-do run { target c++11 } }
|
||||
|
||||
extern "C" void abort (void);
|
||||
extern "C" void exit (int);
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
char16_t s[] = u"\uffff";
|
||||
if (sizeof s != 2 * sizeof (char16_t) || s[0] != 0xffff || s[1] != 0)
|
||||
abort ();
|
||||
exit (0);
|
||||
}
|
@ -1,3 +1,9 @@
|
||||
2014-11-29 John Schmerge <jbschmerge@gmail.com>
|
||||
|
||||
PR preprocessor/41698
|
||||
* charset.c (one_utf8_to_utf16): Do not produce surrogate pairs
|
||||
for 0xffff.
|
||||
|
||||
2014-11-25 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR preprocessor/60436
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user