Blame SOURCES/7.4.104

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