Patch 8.2.1553

4 views
Skip to first unread message

Bram Moolenaar

unread,
Aug 31, 2020, 3:15:36 PM8/31/20
to vim...@googlegroups.com

Patch 8.2.1553 (after 8.2.1552)
Problem: Crash in edit test.
Solution: Avoid using invalid pointer.
Files: src/fold.c


*** ../vim-8.2.1552/src/fold.c 2020-08-31 19:58:10.032399977 +0200
--- src/fold.c 2020-08-31 21:13:49.001498809 +0200
***************
*** 608,642 ****

// Find the place to insert the new fold.
gap = &curwin->w_folds;
! for (;;)
{
! if (!foldFind(gap, start_rel, &fp))
! break;
! if (fp->fd_top + fp->fd_len > end_rel)
{
! // New fold is completely inside this fold: Go one level deeper.
! gap = &fp->fd_nested;
! start_rel -= fp->fd_top;
! end_rel -= fp->fd_top;
! if (use_level || fp->fd_flags == FD_LEVEL)
{
! use_level = TRUE;
! if (level >= curwin->w_p_fdl)
closed = TRUE;
}
- else if (fp->fd_flags == FD_CLOSED)
- closed = TRUE;
- ++level;
- }
- else
- {
- // This fold and new fold overlap: Insert here and move some folds
- // inside the new fold.
- break;
}
}

- i = (int)(fp - (fold_T *)gap->ga_data);
if (ga_grow(gap, 1) == OK)
{
fp = (fold_T *)gap->ga_data + i;
--- 608,648 ----

// Find the place to insert the new fold.
gap = &curwin->w_folds;
! if (gap->ga_len == 0)
! i = 0;
! else
{
! for (;;)
{
! if (!foldFind(gap, start_rel, &fp))
! break;
! if (fp->fd_top + fp->fd_len > end_rel)
{
! // New fold is completely inside this fold: Go one level
! // deeper.
! gap = &fp->fd_nested;
! start_rel -= fp->fd_top;
! end_rel -= fp->fd_top;
! if (use_level || fp->fd_flags == FD_LEVEL)
! {
! use_level = TRUE;
! if (level >= curwin->w_p_fdl)
! closed = TRUE;
! }
! else if (fp->fd_flags == FD_CLOSED)
closed = TRUE;
+ ++level;
+ }
+ else
+ {
+ // This fold and new fold overlap: Insert here and move some
+ // folds inside the new fold.
+ break;
}
}
+ i = (int)(fp - (fold_T *)gap->ga_data);
}

if (ga_grow(gap, 1) == OK)
{
fp = (fold_T *)gap->ga_data + i;
*** ../vim-8.2.1552/src/version.c 2020-08-31 19:58:10.032399977 +0200
--- src/version.c 2020-08-31 21:08:24.462316287 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1553,
/**/

--
Q: Why do ducks have flat feet?
A: To stamp out forest fires.

Q: Why do elephants have flat feet?
A: To stamp out flaming ducks.

/// Bram Moolenaar -- Br...@Moolenaar.net -- 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 ///
Reply all
Reply to author
Forward
0 new messages