mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	eval/decode: Do not loose high surrogates followed by high surrogates
This commit is contained in:
		| @@ -499,6 +499,7 @@ json_decode_string_cycle_start: | |||||||
|                   hasnul = true; |                   hasnul = true; | ||||||
|                 } |                 } | ||||||
|                 if (SURROGATE_HI_START <= ch && ch <= SURROGATE_HI_END) { |                 if (SURROGATE_HI_START <= ch && ch <= SURROGATE_HI_END) { | ||||||
|  |                   PUT_FST_IN_PAIR(fst_in_pair, str_end); | ||||||
|                   fst_in_pair = (int) ch; |                   fst_in_pair = (int) ch; | ||||||
|                 } else if (SURROGATE_LO_START <= ch && ch <= SURROGATE_LO_END |                 } else if (SURROGATE_LO_START <= ch && ch <= SURROGATE_LO_END | ||||||
|                            && fst_in_pair != 0) { |                            && fst_in_pair != 0) { | ||||||
|   | |||||||
| @@ -389,6 +389,8 @@ describe('json_decode() function', function() | |||||||
|     eq('\t\xED\xB0\x80', funcs.json_decode('"\\t\\uDC00"')) |     eq('\t\xED\xB0\x80', funcs.json_decode('"\\t\\uDC00"')) | ||||||
|  |  | ||||||
|     eq('\xED\xA0\x80¬', funcs.json_decode('"\\uD800\\u00AC"')) |     eq('\xED\xA0\x80¬', funcs.json_decode('"\\uD800\\u00AC"')) | ||||||
|  |  | ||||||
|  |     eq('\xED\xA0\x80\xED\xA0\x80', funcs.json_decode('"\\uD800\\uD800"')) | ||||||
|   end) |   end) | ||||||
|  |  | ||||||
|   local sp_decode_eq = function(expected, json) |   local sp_decode_eq = function(expected, json) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 ZyX
					ZyX