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