From bb54e32e8a3fdf6c091b3453defdd95207ebe143 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Sun, 5 May 2024 14:42:16 +0300 Subject: [PATCH] json: fix high surrogate escapes Surrogate escapes must add not or 0x10000, as the specified bits go up 0xfffff. --- spa/include/spa/utils/json.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spa/include/spa/utils/json.h b/spa/include/spa/utils/json.h index de849b0c4..7da964398 100644 --- a/spa/include/spa/utils/json.h +++ b/spa/include/spa/utils/json.h @@ -372,7 +372,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;