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