lkundrak / rpms / vim

Forked from rpms/vim 4 years ago
Clone
5691350
To: vim-dev@vim.org
5691350
Subject: Patch 7.0.021
5691350
Fcc: outbox
5691350
From: Bram Moolenaar <Bram@moolenaar.net>
5691350
Mime-Version: 1.0
5691350
Content-Type: text/plain; charset=ISO-8859-1
5691350
Content-Transfer-Encoding: 8bit
5691350
------------
5691350
5691350
Patch 7.0.021
5691350
Problem:    Crash when using "\\[" and "\\]" in 'errorformat'. (Marc Weber)
5691350
Solution:   Check for valid submatches after matching the pattern.
5691350
Files:      src/quickfix.c
5691350
5691350
5691350
*** ../vim-7.0.020/src/quickfix.c	Wed May  3 23:23:30 2006
5691350
--- src/quickfix.c	Tue Jun 20 17:04:20 2006
5691350
***************
5691350
*** 602,614 ****
5691350
  		else
5691350
  		    type = 0;
5691350
  		/*
5691350
! 		 * Extract error message data from matched line
5691350
  		 */
5691350
  		if ((i = (int)fmt_ptr->addr[0]) > 0)		/* %f */
5691350
  		{
5691350
! 		    int c = *regmatch.endp[i];
5691350
  
5691350
  		    /* Expand ~/file and $HOME/file to full path. */
5691350
  		    *regmatch.endp[i] = NUL;
5691350
  		    expand_env(regmatch.startp[i], namebuf, CMDBUFFSIZE);
5691350
  		    *regmatch.endp[i] = c;
5691350
--- 602,620 ----
5691350
  		else
5691350
  		    type = 0;
5691350
  		/*
5691350
! 		 * Extract error message data from matched line.
5691350
! 		 * We check for an actual submatch, because "\[" and "\]" in
5691350
! 		 * the 'errorformat' may cause the wrong submatch to be used.
5691350
  		 */
5691350
  		if ((i = (int)fmt_ptr->addr[0]) > 0)		/* %f */
5691350
  		{
5691350
! 		    int c;
5691350
! 
5691350
! 		    if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL)
5691350
! 			continue;
5691350
  
5691350
  		    /* Expand ~/file and $HOME/file to full path. */
5691350
+ 		    c = *regmatch.endp[i];
5691350
  		    *regmatch.endp[i] = NUL;
5691350
  		    expand_env(regmatch.startp[i], namebuf, CMDBUFFSIZE);
5691350
  		    *regmatch.endp[i] = c;
5691350
***************
5691350
*** 618,652 ****
5691350
--- 624,686 ----
5691350
  			continue;
5691350
  		}
5691350
  		if ((i = (int)fmt_ptr->addr[1]) > 0)		/* %n */
5691350
+ 		{
5691350
+ 		    if (regmatch.startp[i] == NULL)
5691350
+ 			continue;
5691350
  		    enr = (int)atol((char *)regmatch.startp[i]);
5691350
+ 		}
5691350
  		if ((i = (int)fmt_ptr->addr[2]) > 0)		/* %l */
5691350
+ 		{
5691350
+ 		    if (regmatch.startp[i] == NULL)
5691350
+ 			continue;
5691350
  		    lnum = atol((char *)regmatch.startp[i]);
5691350
+ 		}
5691350
  		if ((i = (int)fmt_ptr->addr[3]) > 0)		/* %c */
5691350
+ 		{
5691350
+ 		    if (regmatch.startp[i] == NULL)
5691350
+ 			continue;
5691350
  		    col = (int)atol((char *)regmatch.startp[i]);
5691350
+ 		}
5691350
  		if ((i = (int)fmt_ptr->addr[4]) > 0)		/* %t */
5691350
+ 		{
5691350
+ 		    if (regmatch.startp[i] == NULL)
5691350
+ 			continue;
5691350
  		    type = *regmatch.startp[i];
5691350
+ 		}
5691350
  		if (fmt_ptr->flags == '+' && !multiscan)	/* %+ */
5691350
  		    STRCPY(errmsg, IObuff);
5691350
  		else if ((i = (int)fmt_ptr->addr[5]) > 0)	/* %m */
5691350
  		{
5691350
+ 		    if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL)
5691350
+ 			continue;
5691350
  		    len = (int)(regmatch.endp[i] - regmatch.startp[i]);
5691350
  		    vim_strncpy(errmsg, regmatch.startp[i], len);
5691350
  		}
5691350
  		if ((i = (int)fmt_ptr->addr[6]) > 0)		/* %r */
5691350
+ 		{
5691350
+ 		    if (regmatch.startp[i] == NULL)
5691350
+ 			continue;
5691350
  		    tail = regmatch.startp[i];
5691350
+ 		}
5691350
  		if ((i = (int)fmt_ptr->addr[7]) > 0)		/* %p */
5691350
  		{
5691350
+ 		    if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL)
5691350
+ 			continue;
5691350
  		    col = (int)(regmatch.endp[i] - regmatch.startp[i] + 1);
5691350
  		    if (*((char_u *)regmatch.startp[i]) != TAB)
5691350
  			use_viscol = TRUE;
5691350
  		}
5691350
  		if ((i = (int)fmt_ptr->addr[8]) > 0)		/* %v */
5691350
  		{
5691350
+ 		    if (regmatch.startp[i] == NULL)
5691350
+ 			continue;
5691350
  		    col = (int)atol((char *)regmatch.startp[i]);
5691350
  		    use_viscol = TRUE;
5691350
  		}
5691350
  		if ((i = (int)fmt_ptr->addr[9]) > 0)		/* %s */
5691350
  		{
5691350
+ 		    if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL)
5691350
+ 			continue;
5691350
  		    len = (int)(regmatch.endp[i] - regmatch.startp[i]);
5691350
  		    if (len > CMDBUFFSIZE - 5)
5691350
  			len = CMDBUFFSIZE - 5;
5691350
*** ../vim-7.0.020/src/version.c	Tue Jun 20 16:33:21 2006
5691350
--- src/version.c	Tue Jun 20 17:07:25 2006
5691350
***************
5691350
*** 668,669 ****
5691350
--- 668,671 ----
5691350
  {   /* Add new patch number below this line */
5691350
+ /**/
5691350
+     21,
5691350
  /**/
5691350
5691350
-- 
5691350
TALL KNIGHT: We are now no longer the Knights Who Say Ni!
5691350
ONE KNIGHT:  Ni!
5691350
OTHERS:      Sh!
5691350
ONE KNIGHT:  (whispers) Sorry.
5691350
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
5691350
5691350
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
5691350
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
5691350
\\\        download, build and distribute -- http://www.A-A-P.org        ///
5691350
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///