Patch 9.0.1527

3 views
Skip to first unread message

Bram Moolenaar

unread,
May 8, 2023, 1:26:42 PM5/8/23
to vim...@googlegroups.com

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 -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages