home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.0 / 7.0.021 < prev    next >
Encoding:
Internet Message Format  |  2006-06-19  |  4.1 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 7.0.021
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.0.021
  11. Problem:    Crash when using "\\[" and "\\]" in 'errorformat'. (Marc Weber)
  12. Solution:   Check for valid submatches after matching the pattern.
  13. Files:      src/quickfix.c
  14.  
  15.  
  16. *** ../vim-7.0.020/src/quickfix.c    Wed May  3 23:23:30 2006
  17. --- src/quickfix.c    Tue Jun 20 17:04:20 2006
  18. ***************
  19. *** 602,614 ****
  20.           else
  21.               type = 0;
  22.           /*
  23. !          * Extract error message data from matched line
  24.            */
  25.           if ((i = (int)fmt_ptr->addr[0]) > 0)        /* %f */
  26.           {
  27. !             int c = *regmatch.endp[i];
  28.   
  29.               /* Expand ~/file and $HOME/file to full path. */
  30.               *regmatch.endp[i] = NUL;
  31.               expand_env(regmatch.startp[i], namebuf, CMDBUFFSIZE);
  32.               *regmatch.endp[i] = c;
  33. --- 602,620 ----
  34.           else
  35.               type = 0;
  36.           /*
  37. !          * Extract error message data from matched line.
  38. !          * We check for an actual submatch, because "\[" and "\]" in
  39. !          * the 'errorformat' may cause the wrong submatch to be used.
  40.            */
  41.           if ((i = (int)fmt_ptr->addr[0]) > 0)        /* %f */
  42.           {
  43. !             int c;
  44. !             if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL)
  45. !             continue;
  46.   
  47.               /* Expand ~/file and $HOME/file to full path. */
  48. +             c = *regmatch.endp[i];
  49.               *regmatch.endp[i] = NUL;
  50.               expand_env(regmatch.startp[i], namebuf, CMDBUFFSIZE);
  51.               *regmatch.endp[i] = c;
  52. ***************
  53. *** 618,652 ****
  54. --- 624,686 ----
  55.               continue;
  56.           }
  57.           if ((i = (int)fmt_ptr->addr[1]) > 0)        /* %n */
  58. +         {
  59. +             if (regmatch.startp[i] == NULL)
  60. +             continue;
  61.               enr = (int)atol((char *)regmatch.startp[i]);
  62. +         }
  63.           if ((i = (int)fmt_ptr->addr[2]) > 0)        /* %l */
  64. +         {
  65. +             if (regmatch.startp[i] == NULL)
  66. +             continue;
  67.               lnum = atol((char *)regmatch.startp[i]);
  68. +         }
  69.           if ((i = (int)fmt_ptr->addr[3]) > 0)        /* %c */
  70. +         {
  71. +             if (regmatch.startp[i] == NULL)
  72. +             continue;
  73.               col = (int)atol((char *)regmatch.startp[i]);
  74. +         }
  75.           if ((i = (int)fmt_ptr->addr[4]) > 0)        /* %t */
  76. +         {
  77. +             if (regmatch.startp[i] == NULL)
  78. +             continue;
  79.               type = *regmatch.startp[i];
  80. +         }
  81.           if (fmt_ptr->flags == '+' && !multiscan)    /* %+ */
  82.               STRCPY(errmsg, IObuff);
  83.           else if ((i = (int)fmt_ptr->addr[5]) > 0)    /* %m */
  84.           {
  85. +             if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL)
  86. +             continue;
  87.               len = (int)(regmatch.endp[i] - regmatch.startp[i]);
  88.               vim_strncpy(errmsg, regmatch.startp[i], len);
  89.           }
  90.           if ((i = (int)fmt_ptr->addr[6]) > 0)        /* %r */
  91. +         {
  92. +             if (regmatch.startp[i] == NULL)
  93. +             continue;
  94.               tail = regmatch.startp[i];
  95. +         }
  96.           if ((i = (int)fmt_ptr->addr[7]) > 0)        /* %p */
  97.           {
  98. +             if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL)
  99. +             continue;
  100.               col = (int)(regmatch.endp[i] - regmatch.startp[i] + 1);
  101.               if (*((char_u *)regmatch.startp[i]) != TAB)
  102.               use_viscol = TRUE;
  103.           }
  104.           if ((i = (int)fmt_ptr->addr[8]) > 0)        /* %v */
  105.           {
  106. +             if (regmatch.startp[i] == NULL)
  107. +             continue;
  108.               col = (int)atol((char *)regmatch.startp[i]);
  109.               use_viscol = TRUE;
  110.           }
  111.           if ((i = (int)fmt_ptr->addr[9]) > 0)        /* %s */
  112.           {
  113. +             if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL)
  114. +             continue;
  115.               len = (int)(regmatch.endp[i] - regmatch.startp[i]);
  116.               if (len > CMDBUFFSIZE - 5)
  117.               len = CMDBUFFSIZE - 5;
  118. *** ../vim-7.0.020/src/version.c    Tue Jun 20 16:33:21 2006
  119. --- src/version.c    Tue Jun 20 17:07:25 2006
  120. ***************
  121. *** 668,669 ****
  122. --- 668,671 ----
  123.   {   /* Add new patch number below this line */
  124. + /**/
  125. +     21,
  126.   /**/
  127.  
  128. -- 
  129. TALL KNIGHT: We are now no longer the Knights Who Say Ni!
  130. ONE KNIGHT:  Ni!
  131. OTHERS:      Sh!
  132. ONE KNIGHT:  (whispers) Sorry.
  133.                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
  134.  
  135.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  136. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  137. \\\        download, build and distribute -- http://www.A-A-P.org        ///
  138.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  139.