summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_conf.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nxt_conf.c')
-rw-r--r--src/nxt_conf.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/nxt_conf.c b/src/nxt_conf.c
index bad9165b..4164bd5b 100644
--- a/src/nxt_conf.c
+++ b/src/nxt_conf.c
@@ -1375,31 +1375,28 @@ nxt_conf_json_parse_string(nxt_mp_t *mp, nxt_conf_value_t *value, u_char *start,
p += 4;
- if (utf < 0xd800 || utf > 0xdbff || utf_high) {
- break;
- }
+ if (utf_high != 0) {
+ if (nxt_slow_path(utf < 0xdc00 || utf > 0xdfff)) {
+ return NULL;
+ }
- utf_high = utf;
- utf = 0;
+ utf = ((utf_high - 0xd800) << 10) + (utf - 0xdc00) + 0x10000;
- if (p[0] != '\\' || p[1] != 'u') {
break;
}
- p += 2;
- }
+ if (utf < 0xd800 || utf > 0xdfff) {
+ break;
+ }
- if (utf_high != 0) {
- if (nxt_slow_path(utf_high < 0xd800
- || utf_high > 0xdbff
- || utf < 0xdc00
- || utf > 0xdfff))
- {
- /* Invalid surrogate pair. */
+ if (utf > 0xdbff || p[0] != '\\' || p[1] != 'u') {
return NULL;
}
- utf = ((utf_high - 0xd800) << 10) + (utf - 0xdc00);
+ p += 2;
+
+ utf_high = utf;
+ utf = 0;
}
s = nxt_utf8_encode(s, utf);