Patch 8.2.2181
Problem:    Valgrind warnings for using uninitialized value.
Solution:   Do not use "start" or "end" unless there is a match.
Files:      src/regexp_nfa.c, src/regexp_bt.c


*** ../vim-8.2.2180/src/regexp_nfa.c    2020-12-21 14:54:28.844116987 +0100
--- src/regexp_nfa.c    2020-12-21 16:19:52.401950488 +0100
***************
*** 7227,7247 ****
  #endif
  
  theend:
!     // Make sure the end is never before the start.  Can happen when \zs and
!     // \ze are used.
!     if (REG_MULTI)
      {
!       lpos_T *start = &rex.reg_mmatch->startpos[0];
!       lpos_T *end = &rex.reg_mmatch->endpos[0];
  
!       if (end->lnum < start->lnum
                        || (end->lnum == start->lnum && end->col < start->col))
!           rex.reg_mmatch->endpos[0] = rex.reg_mmatch->startpos[0];
!     }
!     else if (retval > 0)
!     {
!       if (rex.reg_match->endp[0] < rex.reg_match->startp[0])
!           rex.reg_match->endp[0] = rex.reg_match->startp[0];
      }
  
      return retval;
--- 7227,7250 ----
  #endif
  
  theend:
!     if (retval > 0)
      {
!       // Make sure the end is never before the start.  Can happen when \zs and
!       // \ze are used.
!       if (REG_MULTI)
!       {
!           lpos_T *start = &rex.reg_mmatch->startpos[0];
!           lpos_T *end = &rex.reg_mmatch->endpos[0];
  
!           if (end->lnum < start->lnum
                        || (end->lnum == start->lnum && end->col < start->col))
!               rex.reg_mmatch->endpos[0] = rex.reg_mmatch->startpos[0];
!       }
!       else
!       {
!           if (rex.reg_match->endp[0] < rex.reg_match->startp[0])
!               rex.reg_match->endp[0] = rex.reg_match->startp[0];
!       }
      }
  
      return retval;
*** ../vim-8.2.2180/src/regexp_bt.c     2020-12-09 16:36:00.400656191 +0100
--- src/regexp_bt.c     2020-12-21 16:21:43.861564338 +0100
***************
*** 4805,4825 ****
      if (backpos.ga_maxlen > BACKPOS_INITIAL)
        ga_clear(&backpos);
  
!     // Make sure the end is never before the start.  Can happen when \zs and
!     // \ze are used.
!     if (REG_MULTI)
      {
!       lpos_T *start = &rex.reg_mmatch->startpos[0];
!       lpos_T *end = &rex.reg_mmatch->endpos[0];
  
!       if (end->lnum < start->lnum
                        || (end->lnum == start->lnum && end->col < start->col))
!           rex.reg_mmatch->endpos[0] = rex.reg_mmatch->startpos[0];
!     }
!     else
!     {
!       if (rex.reg_match->endp[0] < rex.reg_match->startp[0])
!           rex.reg_match->endp[0] = rex.reg_match->startp[0];
      }
  
      return retval;
--- 4805,4828 ----
      if (backpos.ga_maxlen > BACKPOS_INITIAL)
        ga_clear(&backpos);
  
!     if (retval > 0)
      {
!       // Make sure the end is never before the start.  Can happen when \zs
!       // and \ze are used.
!       if (REG_MULTI)
!       {
!           lpos_T *start = &rex.reg_mmatch->startpos[0];
!           lpos_T *end = &rex.reg_mmatch->endpos[0];
  
!           if (end->lnum < start->lnum
                        || (end->lnum == start->lnum && end->col < start->col))
!               rex.reg_mmatch->endpos[0] = rex.reg_mmatch->startpos[0];
!       }
!       else
!       {
!           if (rex.reg_match->endp[0] < rex.reg_match->startp[0])
!               rex.reg_match->endp[0] = rex.reg_match->startp[0];
!       }
      }
  
      return retval;
*** ../vim-8.2.2180/src/version.c       2020-12-21 18:11:20.841680915 +0100
--- src/version.c       2020-12-21 18:23:43.499329882 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2181,
  /**/

-- 
Imagine a world without hypothetical situations.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202012211724.0BLHORlp2291874%40masaka.moolenaar.net.

Raspunde prin e-mail lui