Karsten Hopp aafbaf
To: vim-dev@vim.org
Karsten Hopp aafbaf
Subject: Patch 7.0.144
Karsten Hopp aafbaf
Fcc: outbox
Karsten Hopp aafbaf
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp aafbaf
Mime-Version: 1.0
Karsten Hopp aafbaf
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp aafbaf
Content-Transfer-Encoding: 8bit
Karsten Hopp aafbaf
------------
Karsten Hopp aafbaf
Karsten Hopp aafbaf
Patch 7.0.144
Karsten Hopp aafbaf
Problem:    May compare two unrelated pointers when matching a pattern against
Karsten Hopp aafbaf
	    a string.  (Dominique Pelle)
Karsten Hopp aafbaf
Solution:   Avoid calling reg_getline() when REG_MULTI is false.
Karsten Hopp aafbaf
Files:	    src/regexp.c
Karsten Hopp aafbaf
Karsten Hopp aafbaf
Karsten Hopp aafbaf
*** ../vim-7.0.143/src/regexp.c	Tue Aug 29 17:28:56 2006
Karsten Hopp aafbaf
--- src/regexp.c	Tue Oct 17 18:30:18 2006
Karsten Hopp aafbaf
***************
Karsten Hopp aafbaf
*** 3777,3784 ****
Karsten Hopp aafbaf
  
Karsten Hopp aafbaf
  	op = OP(scan);
Karsten Hopp aafbaf
  	/* Check for character class with NL added. */
Karsten Hopp aafbaf
! 	if (!reg_line_lbr && WITH_NL(op) && *reginput == NUL
Karsten Hopp aafbaf
! 						    && reglnum <= reg_maxline)
Karsten Hopp aafbaf
  	{
Karsten Hopp aafbaf
  	    reg_nextline();
Karsten Hopp aafbaf
  	}
Karsten Hopp aafbaf
--- 3777,3784 ----
Karsten Hopp aafbaf
  
Karsten Hopp aafbaf
  	op = OP(scan);
Karsten Hopp aafbaf
  	/* Check for character class with NL added. */
Karsten Hopp aafbaf
! 	if (!reg_line_lbr && WITH_NL(op) && REG_MULTI
Karsten Hopp aafbaf
! 				&& *reginput == NUL && reglnum <= reg_maxline)
Karsten Hopp aafbaf
  	{
Karsten Hopp aafbaf
  	    reg_nextline();
Karsten Hopp aafbaf
  	}
Karsten Hopp aafbaf
***************
Karsten Hopp aafbaf
*** 4855,4862 ****
Karsten Hopp aafbaf
  	    break;
Karsten Hopp aafbaf
  
Karsten Hopp aafbaf
  	  case NEWL:
Karsten Hopp aafbaf
! 	    if ((c != NUL || reglnum > reg_maxline || reg_line_lbr)
Karsten Hopp aafbaf
! 					      && (c != '\n' || !reg_line_lbr))
Karsten Hopp aafbaf
  		status = RA_NOMATCH;
Karsten Hopp aafbaf
  	    else if (reg_line_lbr)
Karsten Hopp aafbaf
  		ADVANCE_REGINPUT();
Karsten Hopp aafbaf
--- 4855,4862 ----
Karsten Hopp aafbaf
  	    break;
Karsten Hopp aafbaf
  
Karsten Hopp aafbaf
  	  case NEWL:
Karsten Hopp aafbaf
! 	    if ((c != NUL || !REG_MULTI || reglnum > reg_maxline
Karsten Hopp aafbaf
! 			     || reg_line_lbr) && (c != '\n' || !reg_line_lbr))
Karsten Hopp aafbaf
  		status = RA_NOMATCH;
Karsten Hopp aafbaf
  	    else if (reg_line_lbr)
Karsten Hopp aafbaf
  		ADVANCE_REGINPUT();
Karsten Hopp aafbaf
***************
Karsten Hopp aafbaf
*** 5316,5323 ****
Karsten Hopp aafbaf
  		++count;
Karsten Hopp aafbaf
  		mb_ptr_adv(scan);
Karsten Hopp aafbaf
  	    }
Karsten Hopp aafbaf
! 	    if (!WITH_NL(OP(p)) || reglnum > reg_maxline || reg_line_lbr
Karsten Hopp aafbaf
! 							 || count == maxcount)
Karsten Hopp aafbaf
  		break;
Karsten Hopp aafbaf
  	    ++count;		/* count the line-break */
Karsten Hopp aafbaf
  	    reg_nextline();
Karsten Hopp aafbaf
--- 5316,5323 ----
Karsten Hopp aafbaf
  		++count;
Karsten Hopp aafbaf
  		mb_ptr_adv(scan);
Karsten Hopp aafbaf
  	    }
Karsten Hopp aafbaf
! 	    if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline
Karsten Hopp aafbaf
! 					 || reg_line_lbr || count == maxcount)
Karsten Hopp aafbaf
  		break;
Karsten Hopp aafbaf
  	    ++count;		/* count the line-break */
Karsten Hopp aafbaf
  	    reg_nextline();
Karsten Hopp aafbaf
***************
Karsten Hopp aafbaf
*** 5341,5347 ****
Karsten Hopp aafbaf
  	    }
Karsten Hopp aafbaf
  	    else if (*scan == NUL)
Karsten Hopp aafbaf
  	    {
Karsten Hopp aafbaf
! 		if (!WITH_NL(OP(p)) || reglnum > reg_maxline || reg_line_lbr)
Karsten Hopp aafbaf
  		    break;
Karsten Hopp aafbaf
  		reg_nextline();
Karsten Hopp aafbaf
  		scan = reginput;
Karsten Hopp aafbaf
--- 5341,5348 ----
Karsten Hopp aafbaf
  	    }
Karsten Hopp aafbaf
  	    else if (*scan == NUL)
Karsten Hopp aafbaf
  	    {
Karsten Hopp aafbaf
! 		if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline
Karsten Hopp aafbaf
! 							      || reg_line_lbr)
Karsten Hopp aafbaf
  		    break;
Karsten Hopp aafbaf
  		reg_nextline();
Karsten Hopp aafbaf
  		scan = reginput;
Karsten Hopp aafbaf
***************
Karsten Hopp aafbaf
*** 5370,5376 ****
Karsten Hopp aafbaf
  	    }
Karsten Hopp aafbaf
  	    else if (*scan == NUL)
Karsten Hopp aafbaf
  	    {
Karsten Hopp aafbaf
! 		if (!WITH_NL(OP(p)) || reglnum > reg_maxline || reg_line_lbr)
Karsten Hopp aafbaf
  		    break;
Karsten Hopp aafbaf
  		reg_nextline();
Karsten Hopp aafbaf
  		scan = reginput;
Karsten Hopp aafbaf
--- 5371,5378 ----
Karsten Hopp aafbaf
  	    }
Karsten Hopp aafbaf
  	    else if (*scan == NUL)
Karsten Hopp aafbaf
  	    {
Karsten Hopp aafbaf
! 		if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline
Karsten Hopp aafbaf
! 							      || reg_line_lbr)
Karsten Hopp aafbaf
  		    break;
Karsten Hopp aafbaf
  		reg_nextline();
Karsten Hopp aafbaf
  		scan = reginput;
Karsten Hopp aafbaf
***************
Karsten Hopp aafbaf
*** 5399,5405 ****
Karsten Hopp aafbaf
  	    }
Karsten Hopp aafbaf
  	    else if (*scan == NUL)
Karsten Hopp aafbaf
  	    {
Karsten Hopp aafbaf
! 		if (!WITH_NL(OP(p)) || reglnum > reg_maxline || reg_line_lbr)
Karsten Hopp aafbaf
  		    break;
Karsten Hopp aafbaf
  		reg_nextline();
Karsten Hopp aafbaf
  		scan = reginput;
Karsten Hopp aafbaf
--- 5401,5408 ----
Karsten Hopp aafbaf
  	    }
Karsten Hopp aafbaf
  	    else if (*scan == NUL)
Karsten Hopp aafbaf
  	    {
Karsten Hopp aafbaf
! 		if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline
Karsten Hopp aafbaf
! 							      || reg_line_lbr)
Karsten Hopp aafbaf
  		    break;
Karsten Hopp aafbaf
  		reg_nextline();
Karsten Hopp aafbaf
  		scan = reginput;
Karsten Hopp aafbaf
***************
Karsten Hopp aafbaf
*** 5424,5430 ****
Karsten Hopp aafbaf
  	{
Karsten Hopp aafbaf
  	    if (*scan == NUL)
Karsten Hopp aafbaf
  	    {
Karsten Hopp aafbaf
! 		if (!WITH_NL(OP(p)) || reglnum > reg_maxline || reg_line_lbr)
Karsten Hopp aafbaf
  		    break;
Karsten Hopp aafbaf
  		reg_nextline();
Karsten Hopp aafbaf
  		scan = reginput;
Karsten Hopp aafbaf
--- 5427,5434 ----
Karsten Hopp aafbaf
  	{
Karsten Hopp aafbaf
  	    if (*scan == NUL)
Karsten Hopp aafbaf
  	    {
Karsten Hopp aafbaf
! 		if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline
Karsten Hopp aafbaf
! 							      || reg_line_lbr)
Karsten Hopp aafbaf
  		    break;
Karsten Hopp aafbaf
  		reg_nextline();
Karsten Hopp aafbaf
  		scan = reginput;
Karsten Hopp aafbaf
***************
Karsten Hopp aafbaf
*** 5454,5460 ****
Karsten Hopp aafbaf
  #endif
Karsten Hopp aafbaf
  	    if (*scan == NUL)
Karsten Hopp aafbaf
  	    {
Karsten Hopp aafbaf
! 		if (!WITH_NL(OP(p)) || reglnum > reg_maxline || reg_line_lbr)
Karsten Hopp aafbaf
  		    break;
Karsten Hopp aafbaf
  		reg_nextline();
Karsten Hopp aafbaf
  		scan = reginput;
Karsten Hopp aafbaf
--- 5458,5465 ----
Karsten Hopp aafbaf
  #endif
Karsten Hopp aafbaf
  	    if (*scan == NUL)
Karsten Hopp aafbaf
  	    {
Karsten Hopp aafbaf
! 		if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline
Karsten Hopp aafbaf
! 							      || reg_line_lbr)
Karsten Hopp aafbaf
  		    break;
Karsten Hopp aafbaf
  		reg_nextline();
Karsten Hopp aafbaf
  		scan = reginput;
Karsten Hopp aafbaf
***************
Karsten Hopp aafbaf
*** 5617,5623 ****
Karsten Hopp aafbaf
  #endif
Karsten Hopp aafbaf
  	    if (*scan == NUL)
Karsten Hopp aafbaf
  	    {
Karsten Hopp aafbaf
! 		if (!WITH_NL(OP(p)) || reglnum > reg_maxline || reg_line_lbr)
Karsten Hopp aafbaf
  		    break;
Karsten Hopp aafbaf
  		reg_nextline();
Karsten Hopp aafbaf
  		scan = reginput;
Karsten Hopp aafbaf
--- 5622,5629 ----
Karsten Hopp aafbaf
  #endif
Karsten Hopp aafbaf
  	    if (*scan == NUL)
Karsten Hopp aafbaf
  	    {
Karsten Hopp aafbaf
! 		if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline
Karsten Hopp aafbaf
! 							      || reg_line_lbr)
Karsten Hopp aafbaf
  		    break;
Karsten Hopp aafbaf
  		reg_nextline();
Karsten Hopp aafbaf
  		scan = reginput;
Karsten Hopp aafbaf
***************
Karsten Hopp aafbaf
*** 5646,5653 ****
Karsten Hopp aafbaf
  
Karsten Hopp aafbaf
        case NEWL:
Karsten Hopp aafbaf
  	while (count < maxcount
Karsten Hopp aafbaf
! 		&& ((*scan == NUL && reglnum <= reg_maxline && !reg_line_lbr)
Karsten Hopp aafbaf
! 		    || (*scan == '\n' && reg_line_lbr)))
Karsten Hopp aafbaf
  	{
Karsten Hopp aafbaf
  	    count++;
Karsten Hopp aafbaf
  	    if (reg_line_lbr)
Karsten Hopp aafbaf
--- 5652,5659 ----
Karsten Hopp aafbaf
  
Karsten Hopp aafbaf
        case NEWL:
Karsten Hopp aafbaf
  	while (count < maxcount
Karsten Hopp aafbaf
! 		&& ((*scan == NUL && reglnum <= reg_maxline && !reg_line_lbr
Karsten Hopp aafbaf
! 			    && REG_MULTI) || (*scan == '\n' && reg_line_lbr)))
Karsten Hopp aafbaf
  	{
Karsten Hopp aafbaf
  	    count++;
Karsten Hopp aafbaf
  	    if (reg_line_lbr)
Karsten Hopp aafbaf
*** ../vim-7.0.143/src/version.c	Tue Oct 17 18:36:03 2006
Karsten Hopp aafbaf
--- src/version.c	Tue Oct 17 18:48:51 2006
Karsten Hopp aafbaf
***************
Karsten Hopp aafbaf
*** 668,669 ****
Karsten Hopp aafbaf
--- 668,671 ----
Karsten Hopp aafbaf
  {   /* Add new patch number below this line */
Karsten Hopp aafbaf
+ /**/
Karsten Hopp aafbaf
+     144,
Karsten Hopp aafbaf
  /**/
Karsten Hopp aafbaf
Karsten Hopp aafbaf
-- 
Karsten Hopp aafbaf
Be thankful to be in a traffic jam, because it means you own a car.
Karsten Hopp aafbaf
Karsten Hopp aafbaf
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp aafbaf
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp aafbaf
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp aafbaf
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///