vim-patch:9.0.2103: recursive callback may cause issues on some archs (#26013)

Problem:  recursive callback may cause issues on some archs
Solution: Decrease the limit drastically to 20

Recursive callback limit causes problems on some architectures

Since commit 47510f3d6598a1218958c03ed11337a43b73f48d we have a test
that causes a recursive popup callback function to be executed. However
it seems the current limit of 'maxfuncdepth' option value is still too
recursive for some 32bit architectures (e.g. 32bit ARM).

So instead of allowing a default limit of 100 (default value for
'maxfuncdepth'), let's reduce this limit to 20. I don't think there is a
use case where one would need such a high recursive callback limit and a
limit of 20 seems reasonable (although it is currently hard-coded).

closes: vim/vim#13495
closes: vim/vim#13502

2076463e38

Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2023-11-13 06:33:34 +08:00
committed by GitHub
parent 74e23b3b2a
commit 6d14f3ddab
5 changed files with 5 additions and 4 deletions

View File

@@ -87,6 +87,8 @@
#define DICT_MAXNEST 100 // maximum nesting of lists and dicts
#define MAX_CALLBACK_DEPTH 20
static const char *e_missbrac = N_("E111: Missing ']'");
static const char *e_list_end = N_("E697: Missing end of List ']': %s");
static const char e_cannot_slice_dictionary[]
@@ -6061,7 +6063,7 @@ bool callback_call(Callback *const callback, const int argcount_in, typval_T *co
typval_T *const rettv)
FUNC_ATTR_NONNULL_ALL
{
if (callback_depth > p_mfd) {
if (callback_depth > MAX_CALLBACK_DEPTH) {
emsg(_(e_command_too_recursive));
return false;
}