mirror of
https://github.com/neovim/neovim.git
synced 2025-11-11 21:08:53 +00:00
vim-patch:8.0.1115: crash when using foldtextresult() recursively (#8972)
Problem: Crash when using foldtextresult() recursively.
Solution: Avoid recursive calls. (Yasuhiro Matsumoto, closes vim/vim#2098)
495b7dd213
This commit is contained in:
committed by
Justin M. Keyes
parent
d47af7f10e
commit
dd0dd4d78d
@@ -8872,9 +8872,14 @@ static void f_foldtextresult(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
char_u buf[FOLD_TEXT_LEN];
|
||||
foldinfo_T foldinfo;
|
||||
int fold_count;
|
||||
static bool entered = false;
|
||||
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = NULL;
|
||||
if (entered) {
|
||||
return; // reject recursive use
|
||||
}
|
||||
entered = true;
|
||||
linenr_T lnum = tv_get_lnum(argvars);
|
||||
// Treat illegal types and illegal string values for {lnum} the same.
|
||||
if (lnum < 0) {
|
||||
@@ -8888,6 +8893,8 @@ static void f_foldtextresult(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
}
|
||||
rettv->vval.v_string = text;
|
||||
}
|
||||
|
||||
entered = false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user