Patch 8.2.3083
Problem:    Crash when passing null string to charclass().
Solution:   Bail out when string pointer is NULL. (Christian Brabandt,
            closes #8498, closes #8260)
Files:      src/mbyte.c, src/testdir/test_functions.vim


*** ../vim-8.2.3082/src/mbyte.c 2021-06-27 21:29:49.989346334 +0200
--- src/mbyte.c 2021-07-02 20:19:19.468682025 +0200
***************
*** 5587,5593 ****
      void
  f_charclass(typval_T *argvars, typval_T *rettv UNUSED)
  {
!     if (check_for_string_arg(argvars, 0) == FAIL)
        return;
      rettv->vval.v_number = mb_get_class(argvars[0].vval.v_string);
  }
--- 5587,5594 ----
      void
  f_charclass(typval_T *argvars, typval_T *rettv UNUSED)
  {
!     if (check_for_string_arg(argvars, 0) == FAIL
!           || argvars[0].vval.v_string == NULL)
        return;
      rettv->vval.v_number = mb_get_class(argvars[0].vval.v_string);
  }
*** ../vim-8.2.3082/src/testdir/test_functions.vim      2021-06-27 
12:07:12.444471041 +0200
--- src/testdir/test_functions.vim      2021-07-02 20:14:51.624981159 +0200
***************
*** 2169,2174 ****
--- 2169,2176 ----
    call assert_equal(1, charclass('.'))
    call assert_equal(2, charclass('x'))
    call assert_equal(3, charclass("\u203c"))
+   " this used to crash vim
+   call assert_equal(0, "xxx"[-1]->charclass())
  endfunc
  
  func Test_eventhandler()
*** ../vim-8.2.3082/src/version.c       2021-07-01 22:11:24.671619362 +0200
--- src/version.c       2021-07-02 20:18:39.008738963 +0200
***************
*** 757,758 ****
--- 757,760 ----
  {   /* Add new patch number below this line */
+ /**/
+     3083,
  /**/

-- 
Q: How many legs does a giraffe have?
A: Eight: two in front, two behind, two on the left and two on the right

 /// 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/202107030959.1639xpTB2220732%40masaka.moolenaar.net.

Raspunde prin e-mail lui