Patch 8.2.3585
Problem:    Crash when passing float to "term_rows" in the options argument of
            term_start(). (Virginia Senioria)
Solution:   Bail out if the argument is not a number. (closes #9116)
Files:      src/job.c, src/terminal.c, src/testdir/test_terminal.vim


*** ../vim-8.2.3584/src/job.c   2021-10-24 20:34:01.430895189 +0100
--- src/job.c   2021-11-12 15:56:58.630707435 +0000
***************
*** 424,433 ****
            }
            else if (STRCMP(hi->hi_key, "term_rows") == 0)
            {
                if (!(supported2 & JO2_TERM_ROWS))
                    break;
                opt->jo_set2 |= JO2_TERM_ROWS;
!               opt->jo_term_rows = tv_get_number(item);
            }
            else if (STRCMP(hi->hi_key, "term_cols") == 0)
            {
--- 424,437 ----
            }
            else if (STRCMP(hi->hi_key, "term_rows") == 0)
            {
+               int error = FALSE;
+ 
                if (!(supported2 & JO2_TERM_ROWS))
                    break;
                opt->jo_set2 |= JO2_TERM_ROWS;
!               opt->jo_term_rows = tv_get_number_chk(item, &error);
!               if (error)
!                   return FAIL;
            }
            else if (STRCMP(hi->hi_key, "term_cols") == 0)
            {
*** ../vim-8.2.3584/src/terminal.c      2021-10-22 18:55:40.818752232 +0100
--- src/terminal.c      2021-11-12 15:54:18.283169091 +0000
***************
*** 4473,4479 ****
      static void *
  vterm_malloc(size_t size, void *data UNUSED)
  {
!     return alloc_clear(size);
  }
  
      static void
--- 4473,4480 ----
      static void *
  vterm_malloc(size_t size, void *data UNUSED)
  {
!     // make sure that the length is not zero
!     return alloc_clear(size == 0 ? 1L : size);
  }
  
      static void
*** ../vim-8.2.3584/src/testdir/test_terminal.vim       2021-10-16 
13:00:10.940165406 +0100
--- src/testdir/test_terminal.vim       2021-11-12 15:56:37.810247070 +0000
***************
*** 467,472 ****
--- 467,476 ----
    bwipe!
    call assert_equal([7, 27], size)
  
+   if has('float')
+     call assert_fails("call term_start(cmd, {'term_rows': 10.0})", 'E805:')
+   endif
+ 
    call delete('Xtext')
  endfunc
  
*** ../vim-8.2.3584/src/version.c       2021-11-12 11:25:06.291264320 +0000
--- src/version.c       2021-11-12 16:00:54.287932990 +0000
***************
*** 759,760 ****
--- 759,762 ----
  {   /* Add new patch number below this line */
+ /**/
+     3585,
  /**/

-- 
"Shoot for the moon. Even if you miss, you'll land among the stars."

 /// 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/20211112160156.2E6E7C80055%40moolenaar.net.

Raspunde prin e-mail lui