To: vim_dev@googlegroups.com Subject: Patch 8.2.3083 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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 -- Bram@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 ///