Patch 7.0.144
Problem:    May compare two unrelated pointers when matching a pattern against
            a string.  (Dominique Pelle)
Solution:   Avoid calling reg_getline() when REG_MULTI is false.
Files:      src/regexp.c


*** ../vim-7.0.143/src/regexp.c Tue Aug 29 17:28:56 2006
--- src/regexp.c        Tue Oct 17 18:30:18 2006
***************
*** 3777,3784 ****
  
        op = OP(scan);
        /* Check for character class with NL added. */
!       if (!reg_line_lbr && WITH_NL(op) && *reginput == NUL
!                                                   && reglnum <= reg_maxline)
        {
            reg_nextline();
        }
--- 3777,3784 ----
  
        op = OP(scan);
        /* Check for character class with NL added. */
!       if (!reg_line_lbr && WITH_NL(op) && REG_MULTI
!                               && *reginput == NUL && reglnum <= reg_maxline)
        {
            reg_nextline();
        }
***************
*** 4855,4862 ****
            break;
  
          case NEWL:
!           if ((c != NUL || reglnum > reg_maxline || reg_line_lbr)
!                                             && (c != '\n' || !reg_line_lbr))
                status = RA_NOMATCH;
            else if (reg_line_lbr)
                ADVANCE_REGINPUT();
--- 4855,4862 ----
            break;
  
          case NEWL:
!           if ((c != NUL || !REG_MULTI || reglnum > reg_maxline
!                            || reg_line_lbr) && (c != '\n' || !reg_line_lbr))
                status = RA_NOMATCH;
            else if (reg_line_lbr)
                ADVANCE_REGINPUT();
***************
*** 5316,5323 ****
                ++count;
                mb_ptr_adv(scan);
            }
!           if (!WITH_NL(OP(p)) || reglnum > reg_maxline || reg_line_lbr
!                                                        || count == maxcount)
                break;
            ++count;            /* count the line-break */
            reg_nextline();
--- 5316,5323 ----
                ++count;
                mb_ptr_adv(scan);
            }
!           if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline
!                                        || reg_line_lbr || count == maxcount)
                break;
            ++count;            /* count the line-break */
            reg_nextline();
***************
*** 5341,5347 ****
            }
            else if (*scan == NUL)
            {
!               if (!WITH_NL(OP(p)) || reglnum > reg_maxline || reg_line_lbr)
                    break;
                reg_nextline();
                scan = reginput;
--- 5341,5348 ----
            }
            else if (*scan == NUL)
            {
!               if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline
!                                                             || reg_line_lbr)
                    break;
                reg_nextline();
                scan = reginput;
***************
*** 5370,5376 ****
            }
            else if (*scan == NUL)
            {
!               if (!WITH_NL(OP(p)) || reglnum > reg_maxline || reg_line_lbr)
                    break;
                reg_nextline();
                scan = reginput;
--- 5371,5378 ----
            }
            else if (*scan == NUL)
            {
!               if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline
!                                                             || reg_line_lbr)
                    break;
                reg_nextline();
                scan = reginput;
***************
*** 5399,5405 ****
            }
            else if (*scan == NUL)
            {
!               if (!WITH_NL(OP(p)) || reglnum > reg_maxline || reg_line_lbr)
                    break;
                reg_nextline();
                scan = reginput;
--- 5401,5408 ----
            }
            else if (*scan == NUL)
            {
!               if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline
!                                                             || reg_line_lbr)
                    break;
                reg_nextline();
                scan = reginput;
***************
*** 5424,5430 ****
        {
            if (*scan == NUL)
            {
!               if (!WITH_NL(OP(p)) || reglnum > reg_maxline || reg_line_lbr)
                    break;
                reg_nextline();
                scan = reginput;
--- 5427,5434 ----
        {
            if (*scan == NUL)
            {
!               if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline
!                                                             || reg_line_lbr)
                    break;
                reg_nextline();
                scan = reginput;
***************
*** 5454,5460 ****
  #endif
            if (*scan == NUL)
            {
!               if (!WITH_NL(OP(p)) || reglnum > reg_maxline || reg_line_lbr)
                    break;
                reg_nextline();
                scan = reginput;
--- 5458,5465 ----
  #endif
            if (*scan == NUL)
            {
!               if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline
!                                                             || reg_line_lbr)
                    break;
                reg_nextline();
                scan = reginput;
***************
*** 5617,5623 ****
  #endif
            if (*scan == NUL)
            {
!               if (!WITH_NL(OP(p)) || reglnum > reg_maxline || reg_line_lbr)
                    break;
                reg_nextline();
                scan = reginput;
--- 5622,5629 ----
  #endif
            if (*scan == NUL)
            {
!               if (!REG_MULTI || !WITH_NL(OP(p)) || reglnum > reg_maxline
!                                                             || reg_line_lbr)
                    break;
                reg_nextline();
                scan = reginput;
***************
*** 5646,5653 ****
  
        case NEWL:
        while (count < maxcount
!               && ((*scan == NUL && reglnum <= reg_maxline && !reg_line_lbr)
!                   || (*scan == '\n' && reg_line_lbr)))
        {
            count++;
            if (reg_line_lbr)
--- 5652,5659 ----
  
        case NEWL:
        while (count < maxcount
!               && ((*scan == NUL && reglnum <= reg_maxline && !reg_line_lbr
!                           && REG_MULTI) || (*scan == '\n' && reg_line_lbr)))
        {
            count++;
            if (reg_line_lbr)
*** ../vim-7.0.143/src/version.c        Tue Oct 17 18:36:03 2006
--- src/version.c       Tue Oct 17 18:48:51 2006
***************
*** 668,669 ****
--- 668,671 ----
  {   /* Add new patch number below this line */
+ /**/
+     144,
  /**/

-- 
Be thankful to be in a traffic jam, because it means you own a car.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- 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    ///

Reply via email to