diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-11-11 10:21:14 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-11 10:21:14 +0800 |
commit | e9b9a86cd5a555943b87f0ba40c4527561c3c124 (patch) | |
tree | b1f2aef3e5e68053a8d2f08206b2c61083e6f6c1 /test/functional/vimscript/ctx_functions_spec.lua | |
parent | d1b2a5cf5fa583b556457d34a46ce7b940913a66 (diff) | |
download | rneovim-e9b9a86cd5a555943b87f0ba40c4527561c3c124.tar.gz rneovim-e9b9a86cd5a555943b87f0ba40c4527561c3c124.tar.bz2 rneovim-e9b9a86cd5a555943b87f0ba40c4527561c3c124.zip |
fix(context): don't crash on invalid arg to nvim_get_context (#25977)
Note: The crash happens in the second test case when using uninitialized
memory, and therefore doesn't happen with ASAN.
Diffstat (limited to 'test/functional/vimscript/ctx_functions_spec.lua')
-rw-r--r-- | test/functional/vimscript/ctx_functions_spec.lua | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/functional/vimscript/ctx_functions_spec.lua b/test/functional/vimscript/ctx_functions_spec.lua index 5ee84a6d13..66a8ec3550 100644 --- a/test/functional/vimscript/ctx_functions_spec.lua +++ b/test/functional/vimscript/ctx_functions_spec.lua @@ -375,6 +375,12 @@ describe('context functions', function() eq(outofbounds, pcall_err(call, 'ctxset', {dummy = 1}, 0)) end) + it('errors when context dictionary is invalid', function() + call('ctxpush') + eq('Vim:E474: Failed to convert list to msgpack string buffer', + pcall_err(call, 'ctxset', { regs = { {} } })) + end) + it('sets context dictionary at index in context stack', function() nvim('set_var', 'one', 1) nvim('set_var', 'Two', 2) |