Patch 9.0.1527
Problem:    Crash when using negative value for term_cols.
Solution:   Check for invalid term_cols value. (Kenta Sato, closes #12362)
Files:      src/job.c, src/testdir/test_terminal.vim


*** ../vim-9.0.1526/src/job.c   2023-04-22 22:54:28.049802336 +0100
--- src/job.c   2023-05-08 18:23:22.925391775 +0100
***************
*** 272,278 ****
                *lp = tv_get_number(item);
                if (*lp < 0)
                {
!                   semsg(_(e_invalid_value_for_argument_str_str), hi->hi_key, 
tv_get_string(item));
                    return FAIL;
                }
            }
--- 272,279 ----
                *lp = tv_get_number(item);
                if (*lp < 0)
                {
!                   semsg(_(e_invalid_value_for_argument_str_str),
!                                             hi->hi_key, tv_get_string(item));
                    return FAIL;
                }
            }
***************
*** 444,453 ****
            }
            else if (STRCMP(hi->hi_key, "term_cols") == 0)
            {
                if (!(supported2 & JO2_TERM_COLS))
                    break;
                opt->jo_set2 |= JO2_TERM_COLS;
!               opt->jo_term_cols = tv_get_number(item);
            }
            else if (STRCMP(hi->hi_key, "vertical") == 0)
            {
--- 445,463 ----
            }
            else if (STRCMP(hi->hi_key, "term_cols") == 0)
            {
+               int error = FALSE;
+ 
                if (!(supported2 & JO2_TERM_COLS))
                    break;
                opt->jo_set2 |= JO2_TERM_COLS;
!               opt->jo_term_cols = tv_get_number_chk(item, &error);
!               if (error)
!                   return FAIL;
!               if (opt->jo_term_cols < 0 || opt->jo_term_cols > 1000)
!               {
!                   semsg(_(e_invalid_value_for_argument_str), "term_cols");
!                   return FAIL;
!               }
            }
            else if (STRCMP(hi->hi_key, "vertical") == 0)
            {
*** ../vim-9.0.1526/src/testdir/test_terminal.vim       2023-05-05 
22:12:19.064321405 +0100
--- src/testdir/test_terminal.vim       2023-05-08 18:25:08.897286315 +0100
***************
*** 617,622 ****
--- 617,626 ----
    call assert_fails("call term_start(cmd, {'term_rows': 1001})", 'E475:')
    call assert_fails("call term_start(cmd, {'term_rows': 10.0})", 'E805:')
  
+   call assert_fails("call term_start(cmd, {'term_cols': -1})", 'E475:')
+   call assert_fails("call term_start(cmd, {'term_cols': 1001})", 'E475:')
+   call assert_fails("call term_start(cmd, {'term_cols': 10.0})", 'E805:')
+ 
    call delete('Xtext')
  endfunc
  
*** ../vim-9.0.1526/src/version.c       2023-05-08 15:56:17.657756346 +0100
--- src/version.c       2023-05-08 18:22:35.489440811 +0100
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     1527,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
22. You've already visited all the links at Yahoo and you're halfway through
    Lycos.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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 on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230508172636.A67BD1C1B21%40moolenaar.net.

Raspunde prin e-mail lui