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