aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval/json_functions_spec.lua
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2016-03-07 08:54:39 +0300
committerZyX <kp-pav@yandex.ru>2016-04-18 02:48:20 +0300
commiteb806c96205ff776d9cd5df82da72c14e030f6d6 (patch)
tree01a1342880f265708dfda5568cef2cc80b5f6ea3 /test/functional/eval/json_functions_spec.lua
parent52c6cc21899d0d5bf0dffc2cee849063e176e931 (diff)
downloadrneovim-eb806c96205ff776d9cd5df82da72c14e030f6d6.tar.gz
rneovim-eb806c96205ff776d9cd5df82da72c14e030f6d6.tar.bz2
rneovim-eb806c96205ff776d9cd5df82da72c14e030f6d6.zip
eval/decode: Make sure that error messages do not cause overflow
Diffstat (limited to 'test/functional/eval/json_functions_spec.lua')
-rw-r--r--test/functional/eval/json_functions_spec.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/functional/eval/json_functions_spec.lua b/test/functional/eval/json_functions_spec.lua
index aa36b62757..58030fca72 100644
--- a/test/functional/eval/json_functions_spec.lua
+++ b/test/functional/eval/json_functions_spec.lua
@@ -448,6 +448,12 @@ describe('json_decode() function', function()
sp_decode_eq({_TYPE='string', _VAL={'\n\xAB\n'}}, '"\\u0000\\u00AB\\u0000"')
end)
+ it('fails to convert string to latin1 if it is impossible', function()
+ restart('set encoding=latin1')
+ eq('Vim(call):E474: Failed to convert string "ꯍ" from UTF-8',
+ exc_exec('call json_decode(\'"\\uABCD"\')'))
+ end)
+
it('parses U+00C3 correctly', function()
eq('\xC3\x83', funcs.json_decode('"\xC3\x83"'))
end)