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 -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202009061315.086DFLWF893501%40masaka.moolenaar.net.