Patch 8.2.1621
Problem: Crash when using submatch(0, 1) in substitute().
Solution: Increment reference count. (closes #6887)
Files: src/regexp.c, src/testdir/test_substitute.vim
*** ../vim-8.2.1620/src/regexp.c 2020-06-24 20:33:59.569106308 +0200
--- src/regexp.c 2020-09-06 15:10:41.614446351 +0200
***************
*** 2543,2548 ****
--- 2543,2549 ----
list_free(list);
return NULL;
}
+ ++list->lv_refcount;
return list;
}
#endif
*** ../vim-8.2.1620/src/testdir/test_substitute.vim 2020-09-04 21:18:40.488161918 +0200
--- src/testdir/test_substitute.vim 2020-09-06 15:07:47.775215584 +0200
***************
*** 881,886 ****
--- 881,892 ----
call assert_equal([], submatch(1, 1))
endfunc
+ func Test_submatch_list_concatenate()
+ let pat = 'A\(.\)'
+ let Rep = {-> string([submatch(0, 1)] + [[submatch(1)]])}
+ call substitute('A1', pat, Rep, '')->assert_equal("[['A1'], ['1']]")
+ endfunc
+
func Test_substitute_expr_arg()
call assert_equal('123456789-123456789=', substitute('123456789',
\ '\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)',
*** ../vim-8.2.1620/src/version.c 2020-09-05 23:15:56.409267096 +0200
--- src/version.c 2020-09-06 15:11:44.938186923 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1621,
/**/
--
There are three kinds of people: Those who can count & those who can't.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language --
http://www.Zimbu.org ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///