Blob Blame History Raw
To: vim_dev@googlegroups.com
Subject: Patch 7.4.253
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.4.253
Problem:    Crash when using cpp syntax file with pattern using external
	    match. (Havard Garnes)
Solution:   Discard match when end column is before start column.
Files:	    src/regexp.c, src/regexp_nfa.c


*** ../vim-7.4.252/src/regexp.c	2014-04-02 19:00:53.043644100 +0200
--- src/regexp.c	2014-04-06 21:26:17.087362776 +0200
***************
*** 4146,4152 ****
  	    {
  		/* Only accept single line matches. */
  		if (reg_startzpos[i].lnum >= 0
! 			&& reg_endzpos[i].lnum == reg_startzpos[i].lnum)
  		    re_extmatch_out->matches[i] =
  			vim_strnsave(reg_getline(reg_startzpos[i].lnum)
  						       + reg_startzpos[i].col,
--- 4146,4153 ----
  	    {
  		/* Only accept single line matches. */
  		if (reg_startzpos[i].lnum >= 0
! 			&& reg_endzpos[i].lnum == reg_startzpos[i].lnum
! 			&& reg_endzpos[i].col >= reg_startzpos[i].col)
  		    re_extmatch_out->matches[i] =
  			vim_strnsave(reg_getline(reg_startzpos[i].lnum)
  						       + reg_startzpos[i].col,
*** ../vim-7.4.252/src/regexp_nfa.c	2014-03-23 15:12:29.935264336 +0100
--- src/regexp_nfa.c	2014-04-06 21:16:57.111361553 +0200
***************
*** 6781,6788 ****
  	    {
  		struct multipos *mpos = &subs.synt.list.multi[i];
  
! 		/* Only accept single line matches. */
! 		if (mpos->start.lnum >= 0 && mpos->start.lnum == mpos->end.lnum)
  		    re_extmatch_out->matches[i] =
  			vim_strnsave(reg_getline(mpos->start.lnum)
  							    + mpos->start.col,
--- 6781,6790 ----
  	    {
  		struct multipos *mpos = &subs.synt.list.multi[i];
  
! 		/* Only accept single line matches that are valid. */
! 		if (mpos->start.lnum >= 0
! 			&& mpos->start.lnum == mpos->end.lnum
! 			&& mpos->end.col >= mpos->start.col)
  		    re_extmatch_out->matches[i] =
  			vim_strnsave(reg_getline(mpos->start.lnum)
  							    + mpos->start.col,
*** ../vim-7.4.252/src/version.c	2014-04-06 21:08:41.315360470 +0200
--- src/version.c	2014-04-06 21:33:17.271363694 +0200
***************
*** 736,737 ****
--- 736,739 ----
  {   /* Add new patch number below this line */
+ /**/
+     253,
  /**/

-- 
A day without sunshine is like, well, night.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///