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 -- [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/201907201656.x6KGuLLi024835%40masaka.moolenaar.net.

Raspunde prin e-mail lui