Patch 8.1.1720

10 views
Skip to first unread message

Bram Moolenaar

unread,
Jul 20, 2019, 12:56:27 PM7/20/19
to vim...@googlegroups.com

Patch 8.1.1720
Problem: Crash with very long %[] pattern. (Reza Mirzazade farkhani)
Solution: Check for reg_toolong. (closes #4703)
Files: src/regexp.c, src/testdir/test_regexp_utf8.vim


*** ../vim-8.1.1719/src/regexp.c 2019-05-28 23:08:12.076648654 +0200
--- src/regexp.c 2019-07-20 18:37:58.360341169 +0200
***************
*** 2175,2181 ****
--- 2175,2185 ----
if (ret == NULL)
ret = br;
else
+ {
regtail(lastnode, br);
+ if (reg_toolong)
+ return NULL;
+ }

ungetchr();
one_exactly = TRUE;
***************
*** 2200,2205 ****
--- 2204,2211 ----
if (OP(br) == BRANCH)
{
regtail(br, lastbranch);
+ if (reg_toolong)
+ return NULL;
br = OPERAND(br);
}
else
*** ../vim-8.1.1719/src/testdir/test_regexp_utf8.vim 2019-01-31 15:34:35.864056935 +0100
--- src/testdir/test_regexp_utf8.vim 2019-07-20 18:55:15.733049192 +0200
***************
*** 206,208 ****
--- 206,217 ----
call assert_equal(1, "\u3042" =~# '[\u3000-\u4000]')
set re=0
endfunc
+
+ func Test_optmatch_toolong()
+ set re=1
+ " Can only handle about 8000 characters.
+ let pat = '\\%[' .. repeat('x', 9000) .. ']'
+ call assert_fails('call match("abc def", "' .. pat .. '")', 'E339:')
+ set re=0
+ endfunc
+
*** ../vim-8.1.1719/src/version.c 2019-07-20 17:45:45.556285939 +0200
--- src/version.c 2019-07-20 18:42:43.214154460 +0200
***************
*** 779,780 ****
--- 779,782 ----
{ /* Add new patch number below this line */
+ /**/
+ 1720,
/**/

--
"I love deadlines. I especially like the whooshing sound they
make as they go flying by."
-- Douglas Adams

/// 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 ///
Reply all
Reply to author
Forward
0 new messages