mirror of
https://github.com/vim/vim.git
synced 2025-07-24 10:45:12 -04:00
patch 8.2.1553: crash in edit test
Problem: Crash in edit test. Solution: Avoid using invalid pointer.
This commit is contained in:
parent
64f37d3090
commit
2c93c685e3
48
src/fold.c
48
src/fold.c
@ -608,35 +608,41 @@ foldCreate(linenr_T start, linenr_T end)
|
|||||||
|
|
||||||
// Find the place to insert the new fold.
|
// Find the place to insert the new fold.
|
||||||
gap = &curwin->w_folds;
|
gap = &curwin->w_folds;
|
||||||
for (;;)
|
if (gap->ga_len == 0)
|
||||||
|
i = 0;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (!foldFind(gap, start_rel, &fp))
|
for (;;)
|
||||||
break;
|
|
||||||
if (fp->fd_top + fp->fd_len > end_rel)
|
|
||||||
{
|
{
|
||||||
// New fold is completely inside this fold: Go one level deeper.
|
if (!foldFind(gap, start_rel, &fp))
|
||||||
gap = &fp->fd_nested;
|
break;
|
||||||
start_rel -= fp->fd_top;
|
if (fp->fd_top + fp->fd_len > end_rel)
|
||||||
end_rel -= fp->fd_top;
|
|
||||||
if (use_level || fp->fd_flags == FD_LEVEL)
|
|
||||||
{
|
{
|
||||||
use_level = TRUE;
|
// New fold is completely inside this fold: Go one level
|
||||||
if (level >= curwin->w_p_fdl)
|
// 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;
|
closed = TRUE;
|
||||||
|
++level;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// This fold and new fold overlap: Insert here and move some
|
||||||
|
// folds inside the new fold.
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
i = (int)(fp - (fold_T *)gap->ga_data);
|
|
||||||
if (ga_grow(gap, 1) == OK)
|
if (ga_grow(gap, 1) == OK)
|
||||||
{
|
{
|
||||||
fp = (fold_T *)gap->ga_data + i;
|
fp = (fold_T *)gap->ga_data + i;
|
||||||
|
@ -754,6 +754,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1553,
|
||||||
/**/
|
/**/
|
||||||
1552,
|
1552,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user