diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-09-10 15:52:55 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-09-10 15:52:55 +0200 |
commit | 80c3fd7c559c7d329d57afe10db9bfb0adf10e46 (patch) | |
tree | 2633e7ae277f9e18dab2512086b603a555773f50 | |
parent | 26fe0d56912e42c2b16a61b2480e19ba569aee98 (diff) | |
download | vim-git-80c3fd7c559c7d329d57afe10db9bfb0adf10e46.tar.gz |
patch 7.4.2360v7.4.2360
Problem: Invalid memory access when formatting. (Dominique Pelle)
Solution: Make sure cursor line and column are associated.
-rw-r--r-- | src/misc1.c | 10 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/misc1.c b/src/misc1.c index 99f963ce0..79014cf29 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -6097,7 +6097,7 @@ cin_isterminated( * 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. + * "first_lnum" is where we start looking. * "min_lnum" is the line before which we will not be looking. */ static int @@ -6108,6 +6108,7 @@ cin_isfuncdecl( { 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,15 +6118,20 @@ cin_isfuncdecl( 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,7 +6687,7 @@ find_start_brace(void) /* XXX */ static pos_T * find_match_paren(int ind_maxparen) /* XXX */ { - return find_match_char('(', ind_maxparen); + return find_match_char('(', ind_maxparen); } static pos_T * diff --git a/src/version.c b/src/version.c index 65757ab9d..a71647b90 100644 --- a/src/version.c +++ b/src/version.c @@ -764,6 +764,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2360, +/**/ 2359, /**/ 2358, |