]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.2103: recursive callback may cause issues on some archs v9.0.2103
authorChristian Brabandt <cb@256bit.org>
Sun, 12 Nov 2023 15:59:29 +0000 (16:59 +0100)
committerChristian Brabandt <cb@256bit.org>
Sun, 12 Nov 2023 15:59:29 +0000 (16:59 +0100)
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: #13495
closes: #13502

Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/doc/message.txt
runtime/doc/options.txt
src/userfunc.c
src/version.c

index 240f2c4326c24e75dfe3f05ee7ef1da06afee7a5..f8a9fdfa604b40b7f4a2dbd2eeeff17e9c435da9 100644 (file)
@@ -1,4 +1,4 @@
-*message.txt*   For Vim version 9.0.  Last change: 2023 May 24
+*message.txt*   For Vim version 9.0.  Last change: 2023 Nov 08
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -135,6 +135,8 @@ This happens when an Ex command executes an Ex command that executes an Ex
 command, etc.  The limit is 200 or the value of 'maxfuncdepth', whatever is
 larger.  When it's more there probably is an endless loop.  Probably a
 |:execute| or |:source| command is involved.
+Can also happen with a recursive callback function (|job-callback|).
+A limit of 20 is used here.
 
                                                        *E254*
   Cannot allocate color {name} ~
index 76efc5d41618d77280618ab06b39fa392e4cd2a4..77efbd63f24e6d1196f4254a2983359a24ef66be 100644 (file)
@@ -5486,7 +5486,6 @@ A jump table for the options with a short description can be found at |Q_op|.
        Increasing this limit above 200 also changes the maximum for Ex
        command recursion, see |E169|.
        See also |:function|.
-       Also used for maximum depth of callback functions.
 
                                                *'maxmapdepth'* *'mmd'* *E223*
 'maxmapdepth' 'mmd'    number  (default 1000)
index 5ef0f7d9c981c69861a53248f77bf9ef8a42a1e3..33e73a9a5248bff61f764a06616c8a9f13210ce6 100644 (file)
@@ -14,6 +14,9 @@
 #include "vim.h"
 
 #if defined(FEAT_EVAL) || defined(PROTO)
+
+#define MAX_CALLBACK_DEPTH 20
+
 /*
  * All user-defined functions are found in this hashtable.
  */
@@ -3584,7 +3587,7 @@ call_callback(
     if (callback->cb_name == NULL || *callback->cb_name == NUL)
        return FAIL;
 
-    if (callback_depth > p_mfd)
+    if (callback_depth > MAX_CALLBACK_DEPTH)
     {
        emsg(_(e_command_too_recursive));
        return FAIL;
index 238e3df10162c2139e579684662a80876cedb811..8afbc403d264193521c8a2033b011615f3537517 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2103,
 /**/
     2102,
 /**/