patch 9.2.0273: tabpanel: undefined behaviour with large tabpanelop columns

Commit: 
https://github.com/vim/vim/commit/ac18dff65aa055dfdfb5b7c36870c84f742e7ead
Author: Christian Brabandt <[email protected]>
Date:   Tue Mar 31 16:13:25 2026 +0000

    patch 9.2.0273: tabpanel: undefined behaviour with large tabpanelop columns
    
    Problem:  tabpanel: undefined behaviour with large tabpanelop columns
              (Michał Majchrowicz)
    Solution: Error out for too large column values
    
    Co-authored-by: Michał Majchrowicz <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/tabpanel.c b/src/tabpanel.c
index 12d644683..c47b6b6e4 100644
--- a/src/tabpanel.c
+++ b/src/tabpanel.c
@@ -57,7 +57,7 @@ tabpanelopt_changed(void)
 {
     char_u     *p;
     int                new_align = ALIGN_LEFT;
-    int                new_columns = 20;
+    long       new_columns = 20;
     int                new_is_vert = FALSE;
 
     p = p_tplo;
@@ -83,6 +83,8 @@ tabpanelopt_changed(void)
        {
            p += 8;
            new_columns = getdigits(&p);
+           if (new_columns < 1 || new_columns > 1000)
+               return FAIL;
        }
        else if (STRNCMP(p, "vert", 4) == 0)
        {
diff --git a/src/testdir/test_tabpanel.vim b/src/testdir/test_tabpanel.vim
index 4837a643d..0329dd7a4 100644
--- a/src/testdir/test_tabpanel.vim
+++ b/src/testdir/test_tabpanel.vim
@@ -887,4 +887,9 @@ func Test_tabpanel_no_modeline()
   bw!
 endfunc
 
+func Test_tabpanel_large_columns()
+  call assert_fails(':set tabpanelopt=columns:10001', 'E474:')
+  call assert_fails(':set tabpanelopt=columns:-1', 'E474:')
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 7ea6b064f..35702fe0c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    273,
 /**/
     272,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1w7byd-00F7pn-DM%40256bit.org.

Raspunde prin e-mail lui