home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.4 / 7.4.421 < prev    next >
Encoding:
Internet Message Format  |  2014-08-29  |  3.4 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.4.421
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.4.421
  11. Problem:    Crash when searching for "\ze*". (Urtica Dioica)
  12. Solution:   Disallow a multi after \ze and \zs.
  13. Files:        src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
  14.  
  15.  
  16. *** ../vim-7.4.420/src/regexp_nfa.c    2014-05-13 19:37:19.489786520 +0200
  17. --- src/regexp_nfa.c    2014-08-29 11:14:12.030416520 +0200
  18. ***************
  19. *** 291,296 ****
  20. --- 291,297 ----
  21.   static int nfa_regconcat __ARGS((void));
  22.   static int nfa_regbranch __ARGS((void));
  23.   static int nfa_reg __ARGS((int paren));
  24. + static int re_mult_next __ARGS((char *what));
  25.   #ifdef DEBUG
  26.   static void nfa_set_code __ARGS((int c));
  27.   static void nfa_postfix_dump __ARGS((char_u *expr, int retval));
  28. ***************
  29. *** 1323,1332 ****
  30. --- 1324,1337 ----
  31.           {
  32.           case 's':
  33.               EMIT(NFA_ZSTART);
  34. +             if (re_mult_next("\\zs") == FAIL)
  35. +             return FAIL;
  36.               break;
  37.           case 'e':
  38.               EMIT(NFA_ZEND);
  39.               nfa_has_zend = TRUE;
  40. +             if (re_mult_next("\\ze") == FAIL)
  41. +             return FAIL;
  42.               break;
  43.   #ifdef FEAT_SYN_HL
  44.           case '1':
  45. ***************
  46. *** 2276,2281 ****
  47. --- 2281,2298 ----
  48.       return OK;
  49.   }
  50.   
  51. + /*
  52. +  * Used in a place where no * or \+ can follow.
  53. +  */
  54. +     static int
  55. + re_mult_next(what)
  56. +     char *what;
  57. + {
  58. +     if (re_multi_type(peekchr()) == MULTI_MULT)
  59. +     EMSG2_RET_FAIL(_("E888: (NFA regexp) cannot repeat %s"), what);
  60. +     return OK;
  61. + }
  62.   #ifdef DEBUG
  63.   static char_u code[50];
  64.   
  65. *** ../vim-7.4.420/src/testdir/test64.in    2014-05-13 16:44:25.633695709 +0200
  66. --- src/testdir/test64.in    2014-08-29 11:33:12.330419011 +0200
  67. ***************
  68. *** 459,465 ****
  69.   :  let text = t[2]
  70.   :  let matchidx = 3
  71.   :  for engine in [0, 1, 2]
  72. ! :    if engine == 2 && re == 0 || engine == 1 && re ==1
  73.   :      continue
  74.   :    endif
  75.   :    let ®expengine = engine
  76. --- 459,465 ----
  77.   :  let text = t[2]
  78.   :  let matchidx = 3
  79.   :  for engine in [0, 1, 2]
  80. ! :    if engine == 2 && re == 0 || engine == 1 && re == 1
  81.   :      continue
  82.   :    endif
  83.   :    let ®expengine = engine
  84. ***************
  85. *** 608,613 ****
  86. --- 608,624 ----
  87.   "ayb20gg/..\%$
  88.   "bybGo"apo"bp:"
  89.   :"
  90. + :" Check for detecting error
  91. + :set regexpengine=2
  92. + :for pat in [' \ze*', ' \zs*']
  93. + :  try
  94. + :    let l = matchlist('x x', pat)
  95. + :    $put ='E888 NOT detected for ' . pat
  96. + :  catch
  97. + :    $put ='E888 detected for ' . pat
  98. + :  endtry
  99. + :endfor
  100. + :"
  101.   :""""" Write the results """""""""""""
  102.   :/\%#=1^Results/,$wq! test.out
  103.   ENDTEST
  104. *** ../vim-7.4.420/src/testdir/test64.ok    2014-05-13 16:44:25.633695709 +0200
  105. --- src/testdir/test64.ok    2014-08-29 11:36:05.782419390 +0200
  106. ***************
  107. *** 1097,1099 ****
  108. --- 1097,1101 ----
  109.   Test END
  110.   EN
  111.   E
  112. + E888 detected for  \ze*
  113. + E888 detected for  \zs*
  114. *** ../vim-7.4.420/src/version.c    2014-08-29 10:04:32.226407390 +0200
  115. --- src/version.c    2014-08-29 11:37:15.794419543 +0200
  116. ***************
  117. *** 743,744 ****
  118. --- 743,746 ----
  119.   {   /* Add new patch number below this line */
  120. + /**/
  121. +     421,
  122.   /**/
  123.  
  124. -- 
  125. From "know your smileys":
  126.  :----}  You lie like Pinocchio
  127.  
  128.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  129. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  130. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  131.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  132.