mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 15:21:47 +00:00
eval: Fix overflow in error message in f_json_decode
This commit is contained in:
@@ -6,6 +6,7 @@ local eq = helpers.eq
|
||||
local eval = helpers.eval
|
||||
local execute = helpers.execute
|
||||
local exc_exec = helpers.exc_exec
|
||||
local redir_exec = helpers.redir_exec
|
||||
|
||||
describe('json_decode() function', function()
|
||||
local restart = function(cmd)
|
||||
@@ -529,6 +530,13 @@ describe('json_decode() function', function()
|
||||
restart('set encoding=latin1')
|
||||
eq(('%c'):format(0xAB), funcs.json_decode('"«"'))
|
||||
end)
|
||||
|
||||
it('does not overflow when writing error message about decoding ["", ""]',
|
||||
function()
|
||||
eq('\nE474: Attempt to decode a blank string'
|
||||
.. '\nE474: Failed to parse \n',
|
||||
redir_exec('call json_decode(["", ""])'))
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('json_encode() function', function()
|
||||
|
Reference in New Issue
Block a user