Blob Blame History Raw
To: vim-dev@vim.org
Subject: Patch 7.1.173
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.1.173
Problem:    Accessing freed memory. (Dominique Pelle)
Solution:   Don't call reg_getline() to check if a line is the first in the
	    file.
Files:	    src/regexp.c


*** ../vim-7.1.172/src/regexp.c	Thu Nov 29 21:26:38 2007
--- src/regexp.c	Sat Dec  8 15:54:05 2007
***************
*** 3810,3820 ****
  	    break;
  
  	  case RE_BOF:
! 	    /* Passing -1 to the getline() function provided for the search
! 	     * should always return NULL if the current line is the first
! 	     * line of the file. */
  	    if (reglnum != 0 || reginput != regline
! 			|| (REG_MULTI && reg_getline((linenr_T)-1) != NULL))
  		status = RA_NOMATCH;
  	    break;
  
--- 3810,3820 ----
  	    break;
  
  	  case RE_BOF:
! 	    /* We're not at the beginning of the file when below the first
! 	     * line where we started, not at the start of the line or we
! 	     * didn't start at the first line of the buffer. */
  	    if (reglnum != 0 || reginput != regline
! 					  || (REG_MULTI && reg_firstlnum > 1))
  		status = RA_NOMATCH;
  	    break;
  
*** ../vim-7.1.172/src/version.c	Sat Dec  8 22:20:24 2007
--- src/version.c	Sun Dec  9 19:24:36 2007
***************
*** 668,669 ****
--- 668,671 ----
  {   /* Add new patch number below this line */
+ /**/
+     173,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
213. Your kids start referring to you as "that guy in front of the monitor."

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///