ext/yajl/yajl_encode.c in yajl-ruby-1.2.3 vs ext/yajl/yajl_encode.c in yajl-ruby-1.3.0
- old
+ new
@@ -160,11 +160,11 @@
unsigned int codepoint = 0;
hexToDigit(&codepoint, str + ++end);
end+=3;
/* check if this is a surrogate */
if ((codepoint & 0xFC00) == 0xD800) {
- if (end + 2 < len && str[end + 1] == '\\' && str[end + 2] == 'u') {
- end++;
+ end++;
+ if (str[end] == '\\' && str[end + 1] == 'u') {
unsigned int surrogate = 0;
hexToDigit(&surrogate, str + end + 2);
codepoint =
(((codepoint & 0x3F) << 10) |
((((codepoint >> 6) & 0xF) + 1) << 16) |