aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-08-02 06:00:02 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-08-02 07:14:42 +0800
commit6af359ef4cc3c221e0e3102ab2b54cf64d7c9835 (patch)
tree39230226ac82217aaba7b4c2b3d72a99ac63143b /test/functional/legacy
parenta4bec30b7b2fa66a2db9d03f54e51dff58116465 (diff)
downloadrneovim-6af359ef4cc3c221e0e3102ab2b54cf64d7c9835.tar.gz
rneovim-6af359ef4cc3c221e0e3102ab2b54cf64d7c9835.tar.bz2
rneovim-6af359ef4cc3c221e0e3102ab2b54cf64d7c9835.zip
vim-patch:9.1.0647: [security] use-after-free in tagstack_clear_entry
Problem: [security] use-after-free in tagstack_clear_entry (Suyue Guo ) Solution: Instead of manually calling vim_free() on each of the tagstack entries, let's use tagstack_clear_entry(), which will also free the stack, but using the VIM_CLEAR macro, which prevents a use-after-free by setting those pointers to NULL This addresses CVE-2024-41957 Github advisory: https://github.com/vim/vim/security/advisories/GHSA-f9cr-gv85-hcr4 https://github.com/vim/vim/commit/8a0bbe7b8aad6f8da28dee218c01bc8a0185a2d5 Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'test/functional/legacy')
-rw-r--r--test/functional/legacy/crash_spec.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/functional/legacy/crash_spec.lua b/test/functional/legacy/crash_spec.lua
index 04f77c7d4f..e72c3a512a 100644
--- a/test/functional/legacy/crash_spec.lua
+++ b/test/functional/legacy/crash_spec.lua
@@ -1,8 +1,12 @@
+local t = require('test.testutil')
local n = require('test.functional.testnvim')()
local assert_alive = n.assert_alive
local clear = n.clear
local command = n.command
+local eq = t.eq
+local eval = n.eval
+local exec = n.exec
local feed = n.feed
before_each(clear)
@@ -32,3 +36,18 @@ it('no crash with very long option error message', function()
pcall(command, 'source test/old/testdir/crash/poc_did_set_langmap')
assert_alive()
end)
+
+it('no crash when closing window with tag in loclist', function()
+ exec([[
+ new
+ lexpr ['foo']
+ lopen
+ let g:qf_bufnr = bufnr()
+ lclose
+ call settagstack(1, #{items: [#{tagname: 'foo', from: [g:qf_bufnr, 1, 1, 0]}]})
+ ]])
+ eq(1, eval('bufexists(g:qf_bufnr)'))
+ command('1close')
+ eq(0, eval('bufexists(g:qf_bufnr)'))
+ assert_alive()
+end)