Blame SOURCES/7.4.104

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