json: fix high surrogate escapes

Surrogate escapes must add not or 0x10000, as the specified bits go up
0xfffff.
This commit is contained in:
Pauli Virtanen 2024-05-05 14:42:16 +03:00
parent eea18a8a8a
commit 22ac5f85cc
3 changed files with 1 additions and 5 deletions

View file

@ -594,7 +594,7 @@ static inline int spa_json_parse_stringn(const char *val, int len, char *result,
v < 0xdc00 || v > 0xdfff)
continue;
p += 6;
cp = 0x010000 | ((cp & 0x3ff) << 10) | (v & 0x3ff);
cp = 0x010000 + (((cp & 0x3ff) << 10) | (v & 0x3ff));
} else if (cp >= 0xdc00 && cp <= 0xdfff)
continue;