diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-09-22 06:51:59 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-09-22 06:51:59 +0000 |
commit | 1e39ea08122ef6db924f2ae622e03d4bedde8cd5 (patch) | |
tree | 598267383110c528398d177dec1365ee28ebfc71 /gcc | |
parent | d47cbb6dd43e5cd02d107f336cbd9554c62acd80 (diff) | |
download | gcc-1e39ea08122ef6db924f2ae622e03d4bedde8cd5.zip gcc-1e39ea08122ef6db924f2ae622e03d4bedde8cd5.tar.gz gcc-1e39ea08122ef6db924f2ae622e03d4bedde8cd5.tar.bz2 |
compiler, runtime: Reject surrogate pair converting int to string.
From-SVN: r191636
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/go/gofrontend/lex.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/lex.cc b/gcc/go/gofrontend/lex.cc index 25aaeb7..6add84e 100644 --- a/gcc/go/gofrontend/lex.cc +++ b/gcc/go/gofrontend/lex.cc @@ -1312,6 +1312,12 @@ Lex::append_char(unsigned int v, bool is_character, std::string* str, // Turn it into the "replacement character". v = 0xfffd; } + if (v >= 0xd800 && v < 0xe000) + { + warning_at(location, 0, + "unicode code point 0x%x is invalid surrogate pair", v); + v = 0xfffd; + } if (v <= 0xffff) { buf[0] = 0xe0 + (v >> 12); |