jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone

Blame SOURCES/7.4.104

8b9a1c
To: vim_dev@googlegroups.com
8b9a1c
Subject: Patch 7.4.104
8b9a1c
Fcc: outbox
8b9a1c
From: Bram Moolenaar <Bram@moolenaar.net>
8b9a1c
Mime-Version: 1.0
8b9a1c
Content-Type: text/plain; charset=UTF-8
8b9a1c
Content-Transfer-Encoding: 8bit
8b9a1c
------------
8b9a1c
8b9a1c
Patch 7.4.104
8b9a1c
Problem:    ":help s/\_" reports an internal error. (John Beckett)
8b9a1c
Solution:   Check for NUL and invalid character classes.
8b9a1c
Files:	    src/regexp_nfa.c
8b9a1c
8b9a1c
8b9a1c
*** ../vim-7.4.103/src/regexp_nfa.c	2013-11-21 16:03:35.000000000 +0100
8b9a1c
--- src/regexp_nfa.c	2013-11-28 14:05:34.000000000 +0100
8b9a1c
***************
8b9a1c
*** 239,245 ****
8b9a1c
--- 239,247 ----
8b9a1c
      NFA_UPPER, NFA_NUPPER
8b9a1c
  };
8b9a1c
  
8b9a1c
+ static char_u e_nul_found[] = N_("E865: (NFA) Regexp end encountered prematurely");
8b9a1c
  static char_u e_misplaced[] = N_("E866: (NFA regexp) Misplaced %c");
8b9a1c
+ static char_u e_ill_char_class[] = N_("E877: (NFA regexp) Invalid character class: %ld");
8b9a1c
  
8b9a1c
  /* NFA regexp \ze operator encountered. */
8b9a1c
  static int nfa_has_zend;
8b9a1c
***************
8b9a1c
*** 1137,1143 ****
8b9a1c
      switch (c)
8b9a1c
      {
8b9a1c
  	case NUL:
8b9a1c
! 	    EMSG_RET_FAIL(_("E865: (NFA) Regexp end encountered prematurely"));
8b9a1c
  
8b9a1c
  	case Magic('^'):
8b9a1c
  	    EMIT(NFA_BOL);
8b9a1c
--- 1139,1145 ----
8b9a1c
      switch (c)
8b9a1c
      {
8b9a1c
  	case NUL:
8b9a1c
! 	    EMSG_RET_FAIL(_(e_nul_found));
8b9a1c
  
8b9a1c
  	case Magic('^'):
8b9a1c
  	    EMIT(NFA_BOL);
8b9a1c
***************
8b9a1c
*** 1160,1165 ****
8b9a1c
--- 1162,1170 ----
8b9a1c
  
8b9a1c
  	case Magic('_'):
8b9a1c
  	    c = no_Magic(getchr());
8b9a1c
+ 	    if (c == NUL)
8b9a1c
+ 		EMSG_RET_FAIL(_(e_nul_found));
8b9a1c
+ 
8b9a1c
  	    if (c == '^')	/* "\_^" is start-of-line */
8b9a1c
  	    {
8b9a1c
  		EMIT(NFA_BOL);
8b9a1c
***************
8b9a1c
*** 1216,1221 ****
8b9a1c
--- 1221,1232 ----
8b9a1c
  	    p = vim_strchr(classchars, no_Magic(c));
8b9a1c
  	    if (p == NULL)
8b9a1c
  	    {
8b9a1c
+ 		if (extra == NFA_ADD_NL)
8b9a1c
+ 		{
8b9a1c
+ 		    EMSGN(_(e_ill_char_class), c);
8b9a1c
+ 		    rc_did_emsg = TRUE;
8b9a1c
+ 		    return FAIL;
8b9a1c
+ 		}
8b9a1c
  		EMSGN("INTERNAL: Unknown character class char: %ld", c);
8b9a1c
  		return FAIL;
8b9a1c
  	    }
8b9a1c
***************
8b9a1c
*** 4733,4739 ****
8b9a1c
  
8b9a1c
  	default:
8b9a1c
  	    /* should not be here :P */
8b9a1c
! 	    EMSGN("E877: (NFA regexp) Invalid character class: %ld", class);
8b9a1c
  	    return FAIL;
8b9a1c
      }
8b9a1c
      return FAIL;
8b9a1c
--- 4744,4750 ----
8b9a1c
  
8b9a1c
  	default:
8b9a1c
  	    /* should not be here :P */
8b9a1c
! 	    EMSGN(_(e_ill_char_class), class);
8b9a1c
  	    return FAIL;
8b9a1c
      }
8b9a1c
      return FAIL;
8b9a1c
*** ../vim-7.4.103/src/version.c	2013-11-21 18:13:26.000000000 +0100
8b9a1c
--- src/version.c	2013-11-28 14:06:59.000000000 +0100
8b9a1c
***************
8b9a1c
*** 740,741 ****
8b9a1c
--- 740,743 ----
8b9a1c
  {   /* Add new patch number below this line */
8b9a1c
+ /**/
8b9a1c
+     104,
8b9a1c
  /**/
8b9a1c
8b9a1c
-- 
8b9a1c
Everybody wants to go to heaven, but nobody wants to die.
8b9a1c
8b9a1c
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
8b9a1c
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
8b9a1c
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
8b9a1c
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///