Patch 7.4.2360
Problem:    Invalid memory access when formatting. (Dominique Pelle)
Solution:   Make sure cursor line and column are associated.
Files:      src/misc1.c


*** ../vim-7.4.2359/src/misc1.c 2016-08-29 22:48:12.153106148 +0200
--- src/misc1.c 2016-09-10 15:43:04.959262482 +0200
***************
*** 6097,6103 ****
   * When a line ends in a comma we continue looking in the next line.
   * "sp" points to a string with the line.  When looking at other lines it must
   * be restored to the line.  When it's NULL fetch lines here.
!  * "lnum" is where we start looking.
   * "min_lnum" is the line before which we will not be looking.
   */
      static int
--- 6097,6103 ----
   * When a line ends in a comma we continue looking in the next line.
   * "sp" points to a string with the line.  When looking at other lines it must
   * be restored to the line.  When it's NULL fetch lines here.
!  * "first_lnum" is where we start looking.
   * "min_lnum" is the line before which we will not be looking.
   */
      static int
***************
*** 6108,6113 ****
--- 6108,6114 ----
  {
      char_u    *s;
      linenr_T  lnum = first_lnum;
+     linenr_T  save_lnum = curwin->w_cursor.lnum;
      int               retval = FALSE;
      pos_T     *trypos;
      int               just_started = TRUE;
***************
*** 6117,6131 ****
--- 6118,6137 ----
      else
        s = *sp;
  
+     curwin->w_cursor.lnum = lnum;
      if (find_last_paren(s, '(', ')')
        && (trypos = find_match_paren(curbuf->b_ind_maxparen)) != NULL)
      {
        lnum = trypos->lnum;
        if (lnum < min_lnum)
+       {
+           curwin->w_cursor.lnum = save_lnum;
            return FALSE;
+       }
  
        s = ml_get(lnum);
      }
+     curwin->w_cursor.lnum = save_lnum;
  
      /* Ignore line starting with #. */
      if (cin_ispreproc(s))
***************
*** 6681,6687 ****
      static pos_T *
  find_match_paren(int ind_maxparen)    /* XXX */
  {
!  return find_match_char('(', ind_maxparen);
  }
  
      static pos_T *
--- 6687,6693 ----
      static pos_T *
  find_match_paren(int ind_maxparen)    /* XXX */
  {
!     return find_match_char('(', ind_maxparen);
  }
  
      static pos_T *
*** ../vim-7.4.2359/src/version.c       2016-09-10 14:27:27.022052849 +0200
--- src/version.c       2016-09-10 15:50:00.049454110 +0200
***************
*** 765,766 ****
--- 765,768 ----
  {   /* Add new patch number below this line */
+ /**/
+     2360,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
222. You send more than 20 personal e-mails a day.

 /// 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].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui