0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 9.1.0728: [security]: heap-use-after-free in garbage collection with location list user data

Problem:  heap-use-after-free in garbage collection with location list
          user data.
Solution: Mark user data as in use when no other window is referencing
          the location list (zeertzjq)

fixes: neovim/neovim#30371
closes: #15683

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2024-09-14 10:32:31 +02:00
committed by Christian Brabandt
parent d657d3d8fd
commit be4bd189d2
3 changed files with 18 additions and 0 deletions

View File

@@ -8011,6 +8011,10 @@ set_ref_in_quickfix(int copyID)
abort = mark_quickfix_ctx(win->w_llist_ref, copyID); abort = mark_quickfix_ctx(win->w_llist_ref, copyID);
if (abort) if (abort)
return abort; return abort;
abort = mark_quickfix_user_data(win->w_llist_ref, copyID);
if (abort)
return abort;
} }
} }

View File

@@ -4208,6 +4208,18 @@ func Test_ll_window_ctx()
enew | only enew | only
endfunc endfunc
" Similar to the problem above, but for user data.
func Test_ll_window_user_data()
call setloclist(0, [#{bufnr: bufnr(), user_data: {}}])
lopen
wincmd t
close
call test_garbagecollect_now()
call feedkeys("\<CR>", 'tx')
call test_garbagecollect_now()
%bwipe!
endfunc
" The following test used to crash vim " The following test used to crash vim
func Test_lfile_crash() func Test_lfile_crash()
sp Xtest sp Xtest

View File

@@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
728,
/**/ /**/
727, 727,
/**/ /**/