Karsten Hopp 81c285
To: vim-dev@vim.org
Karsten Hopp 81c285
Subject: Patch 7.2.157
Karsten Hopp 81c285
Fcc: outbox
Karsten Hopp 81c285
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 81c285
Mime-Version: 1.0
Karsten Hopp 81c285
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 81c285
Content-Transfer-Encoding: 8bit
Karsten Hopp 81c285
------------
Karsten Hopp 81c285
Karsten Hopp 81c285
Patch 7.2.157
Karsten Hopp 81c285
Problem:    Illegal memory access when searching in path.
Karsten Hopp 81c285
Solution:   Avoid looking at a byte after end of a string. (Dominique Pelle)
Karsten Hopp 81c285
Files:	    src/search.c
Karsten Hopp 81c285
Karsten Hopp 81c285
Karsten Hopp 81c285
*** ../vim-7.2.156/src/search.c	Fri Jul 18 12:05:58 2008
Karsten Hopp 81c285
--- src/search.c	Wed Apr 22 12:26:19 2009
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 2327,2334 ****
Karsten Hopp 81c285
  		    for (col = pos.col; check_prevcol(linep, col, '\\', &col);)
Karsten Hopp 81c285
  			bslcnt++;
Karsten Hopp 81c285
  		}
Karsten Hopp 81c285
! 		/* Only accept a match when 'M' is in 'cpo' or when ecaping is
Karsten Hopp 81c285
! 		 * what we expect. */
Karsten Hopp 81c285
  		if (cpo_bsl || (bslcnt & 1) == match_escaped)
Karsten Hopp 81c285
  		{
Karsten Hopp 81c285
  		    if (c == initc)
Karsten Hopp 81c285
--- 2336,2343 ----
Karsten Hopp 81c285
  		    for (col = pos.col; check_prevcol(linep, col, '\\', &col);)
Karsten Hopp 81c285
  			bslcnt++;
Karsten Hopp 81c285
  		}
Karsten Hopp 81c285
! 		/* Only accept a match when 'M' is in 'cpo' or when escaping
Karsten Hopp 81c285
! 		 * is what we expect. */
Karsten Hopp 81c285
  		if (cpo_bsl || (bslcnt & 1) == match_escaped)
Karsten Hopp 81c285
  		{
Karsten Hopp 81c285
  		    if (c == initc)
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 4663,4669 ****
Karsten Hopp 81c285
  			    msg_putchar('\n');	    /* cursor below last one */
Karsten Hopp 81c285
  			    if (!got_int)	    /* don't display if 'q'
Karsten Hopp 81c285
  						       typed at "--more--"
Karsten Hopp 81c285
! 						       mesage */
Karsten Hopp 81c285
  			    {
Karsten Hopp 81c285
  				msg_home_replace_hl(new_fname);
Karsten Hopp 81c285
  				MSG_PUTS(_(" (includes previously listed match)"));
Karsten Hopp 81c285
--- 4672,4678 ----
Karsten Hopp 81c285
  			    msg_putchar('\n');	    /* cursor below last one */
Karsten Hopp 81c285
  			    if (!got_int)	    /* don't display if 'q'
Karsten Hopp 81c285
  						       typed at "--more--"
Karsten Hopp 81c285
! 						       message */
Karsten Hopp 81c285
  			    {
Karsten Hopp 81c285
  				msg_home_replace_hl(new_fname);
Karsten Hopp 81c285
  				MSG_PUTS(_(" (includes previously listed match)"));
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 4975,4981 ****
Karsten Hopp 81c285
  					    || IObuff[i-2] == '!'))))
Karsten Hopp 81c285
  				IObuff[i++] = ' ';
Karsten Hopp 81c285
  			}
Karsten Hopp 81c285
! 			/* copy as much as posible of the new word */
Karsten Hopp 81c285
  			if (p - aux >= IOSIZE - i)
Karsten Hopp 81c285
  			    p = aux + IOSIZE - i - 1;
Karsten Hopp 81c285
  			STRNCPY(IObuff + i, aux, p - aux);
Karsten Hopp 81c285
--- 4984,4990 ----
Karsten Hopp 81c285
  					    || IObuff[i-2] == '!'))))
Karsten Hopp 81c285
  				IObuff[i++] = ' ';
Karsten Hopp 81c285
  			}
Karsten Hopp 81c285
! 			/* copy as much as possible of the new word */
Karsten Hopp 81c285
  			if (p - aux >= IOSIZE - i)
Karsten Hopp 81c285
  			    p = aux + IOSIZE - i - 1;
Karsten Hopp 81c285
  			STRNCPY(IObuff + i, aux, p - aux);
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 5010,5016 ****
Karsten Hopp 81c285
  		    if (did_show)
Karsten Hopp 81c285
  			msg_putchar('\n');	/* cursor below last one */
Karsten Hopp 81c285
  		    if (!got_int)		/* don't display if 'q' typed
Karsten Hopp 81c285
! 						    at "--more--" mesage */
Karsten Hopp 81c285
  			msg_home_replace_hl(curr_fname);
Karsten Hopp 81c285
  		    prev_fname = curr_fname;
Karsten Hopp 81c285
  		}
Karsten Hopp 81c285
--- 5019,5025 ----
Karsten Hopp 81c285
  		    if (did_show)
Karsten Hopp 81c285
  			msg_putchar('\n');	/* cursor below last one */
Karsten Hopp 81c285
  		    if (!got_int)		/* don't display if 'q' typed
Karsten Hopp 81c285
! 						    at "--more--" message */
Karsten Hopp 81c285
  			msg_home_replace_hl(curr_fname);
Karsten Hopp 81c285
  		    prev_fname = curr_fname;
Karsten Hopp 81c285
  		}
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 5092,5098 ****
Karsten Hopp 81c285
  		}
Karsten Hopp 81c285
  		if (action != ACTION_SHOW)
Karsten Hopp 81c285
  		{
Karsten Hopp 81c285
! 		    curwin->w_cursor.col = (colnr_T) (startp - line);
Karsten Hopp 81c285
  		    curwin->w_set_curswant = TRUE;
Karsten Hopp 81c285
  		}
Karsten Hopp 81c285
  
Karsten Hopp 81c285
--- 5101,5107 ----
Karsten Hopp 81c285
  		}
Karsten Hopp 81c285
  		if (action != ACTION_SHOW)
Karsten Hopp 81c285
  		{
Karsten Hopp 81c285
! 		    curwin->w_cursor.col = (colnr_T)(startp - line);
Karsten Hopp 81c285
  		    curwin->w_set_curswant = TRUE;
Karsten Hopp 81c285
  		}
Karsten Hopp 81c285
  
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 5119,5125 ****
Karsten Hopp 81c285
  		    && action == ACTION_EXPAND
Karsten Hopp 81c285
  		    && !(compl_cont_status & CONT_SOL)
Karsten Hopp 81c285
  #endif
Karsten Hopp 81c285
! 		    && *(p = startp + 1))
Karsten Hopp 81c285
  		goto search_line;
Karsten Hopp 81c285
  	}
Karsten Hopp 81c285
  	line_breakcheck();
Karsten Hopp 81c285
--- 5128,5135 ----
Karsten Hopp 81c285
  		    && action == ACTION_EXPAND
Karsten Hopp 81c285
  		    && !(compl_cont_status & CONT_SOL)
Karsten Hopp 81c285
  #endif
Karsten Hopp 81c285
! 		    && *startp != NUL
Karsten Hopp 81c285
! 		    && *(p = startp + 1) != NUL)
Karsten Hopp 81c285
  		goto search_line;
Karsten Hopp 81c285
  	}
Karsten Hopp 81c285
  	line_breakcheck();
Karsten Hopp 81c285
*** ../vim-7.2.156/src/version.c	Wed Apr 22 16:22:44 2009
Karsten Hopp 81c285
--- src/version.c	Wed Apr 22 16:39:59 2009
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 678,679 ****
Karsten Hopp 81c285
--- 678,681 ----
Karsten Hopp 81c285
  {   /* Add new patch number below this line */
Karsten Hopp 81c285
+ /**/
Karsten Hopp 81c285
+     157,
Karsten Hopp 81c285
  /**/
Karsten Hopp 81c285
Karsten Hopp 81c285
Karsten Hopp 81c285
-- 
Karsten Hopp 81c285
ARTHUR:  Bloody peasant!
Karsten Hopp 81c285
DENNIS:  Oh, what a give away.  Did you hear that, did you hear that, eh?
Karsten Hopp 81c285
         That's what I'm on about -- did you see him repressing me, you saw it
Karsten Hopp 81c285
         didn't you?
Karsten Hopp 81c285
                                  The Quest for the Holy Grail (Monty Python)
Karsten Hopp 81c285
Karsten Hopp 81c285
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 81c285
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 81c285
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 81c285
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///