aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/eval/decode.c1
-rw-r--r--test/functional/eval/json_functions_spec.lua2
2 files changed, 3 insertions, 0 deletions
diff --git a/src/nvim/eval/decode.c b/src/nvim/eval/decode.c
index 266da86b74..604b758344 100644
--- a/src/nvim/eval/decode.c
+++ b/src/nvim/eval/decode.c
@@ -499,6 +499,7 @@ json_decode_string_cycle_start:
hasnul = true;
}
if (SURROGATE_HI_START <= ch && ch <= SURROGATE_HI_END) {
+ PUT_FST_IN_PAIR(fst_in_pair, str_end);
fst_in_pair = (int) ch;
} else if (SURROGATE_LO_START <= ch && ch <= SURROGATE_LO_END
&& fst_in_pair != 0) {
diff --git a/test/functional/eval/json_functions_spec.lua b/test/functional/eval/json_functions_spec.lua
index 58030fca72..6379e7fed8 100644
--- a/test/functional/eval/json_functions_spec.lua
+++ b/test/functional/eval/json_functions_spec.lua
@@ -389,6 +389,8 @@ describe('json_decode() function', function()
eq('\t\xED\xB0\x80', funcs.json_decode('"\\t\\uDC00"'))
eq('\xED\xA0\x80¬', funcs.json_decode('"\\uD800\\u00AC"'))
+
+ eq('\xED\xA0\x80\xED\xA0\x80', funcs.json_decode('"\\uD800\\uD800"'))
end)
local sp_decode_eq = function(expected, json)