Commit 763d8752 by Ian Lance Taylor

runtime: Fix handling of surrogate pairs in string([]rune).

From-SVN: r205422
parent b168a8df
...@@ -30,6 +30,8 @@ __go_int_array_to_string (const void* p, intgo len) ...@@ -30,6 +30,8 @@ __go_int_array_to_string (const void* p, intgo len)
if (v < 0 || v > 0x10ffff) if (v < 0 || v > 0x10ffff)
v = 0xfffd; v = 0xfffd;
else if (0xd800 <= v && v <= 0xdfff)
v = 0xfffd;
if (v <= 0x7f) if (v <= 0x7f)
slen += 1; slen += 1;
...@@ -56,6 +58,8 @@ __go_int_array_to_string (const void* p, intgo len) ...@@ -56,6 +58,8 @@ __go_int_array_to_string (const void* p, intgo len)
character. */ character. */
if (v < 0 || v > 0x10ffff) if (v < 0 || v > 0x10ffff)
v = 0xfffd; v = 0xfffd;
else if (0xd800 <= v && v <= 0xdfff)
v = 0xfffd;
if (v <= 0x7f) if (v <= 0x7f)
*s++ = v; *s++ = v;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment