mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
vim-patch:8.2.4979: accessing freed memory when line is flushed (#18634)
Problem: Accessing freed memory when line is flushed.
Solution: Make a copy of the pattern to search for.
28d032cc68
This commit is contained in:
@@ -1077,6 +1077,15 @@ Type number and <Enter> (q or empty cancels):
|
|||||||
%bwipe
|
%bwipe
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_define_search()
|
||||||
|
" this was accessing freed memory
|
||||||
|
new
|
||||||
|
call setline(1, ['first line', '', '#define something 0'])
|
||||||
|
sil norm o0
|
||||||
|
sil! norm
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Test for the 'taglength' option
|
" Test for the 'taglength' option
|
||||||
func Test_tag_length()
|
func Test_tag_length()
|
||||||
set tags=Xtags
|
set tags=Xtags
|
||||||
|
@@ -515,9 +515,14 @@ wingotofile:
|
|||||||
if ((len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0) {
|
if ((len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make a copy, if the line was changed it will be freed.
|
||||||
|
ptr = vim_strnsave(ptr, len);
|
||||||
|
|
||||||
find_pattern_in_path(ptr, 0, len, true, Prenum == 0,
|
find_pattern_in_path(ptr, 0, len, true, Prenum == 0,
|
||||||
type, Prenum1, ACTION_SPLIT, 1, MAXLNUM);
|
type, Prenum1, ACTION_SPLIT, 1, MAXLNUM);
|
||||||
curwin->w_set_curswant = TRUE;
|
xfree(ptr);
|
||||||
|
curwin->w_set_curswant = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Quickfix window only: view the result under the cursor in a new split.
|
// Quickfix window only: view the result under the cursor in a new split.
|
||||||
|
Reference in New Issue
Block a user