This commit is contained in:
Nicolas Williams committed 2015-06-18 00:03:46 -05:00
1 parent 164b877bfa
commit 6083581fea
2 files changed
+6 -2

No files matched your search

+4 -1
View File
@@ -717,7 +717,10 @@ jv jv_string_implode(jv j) {
for (i = 0; i < len; i++) {
jv n = jv_array_get(jv_copy(j), i);
assert(jv_get_kind(n) == JV_KIND_NUMBER);
s = jv_string_append_codepoint(s, jv_number_value(n));
int nv = jv_number_value(n);
if (nv > 0x10FFFF)
nv = 0xFFFD; // U+FFFD REPLACEMENT CHARACTER
s = jv_string_append_codepoint(s, nv);
}
jv_free(j);
+2 -1
View File
@@ -447,7 +447,8 @@ static pfunc found_string(struct jv_parser* p) {
codepoint = 0x10000 + (((codepoint - 0xD800) << 10)
|(surrogate - 0xDC00));
}
// FIXME assert valid codepoint
if (codepoint > 0x10FFFF)
codepoint = 0xFFFD; // U+FFFD REPLACEMENT CHARACTER
out += jvp_utf8_encode(codepoint, out);
break;