Problem: Crash when passing null string to charclass().
Solution: Bail out when string pointer is NULL. (Christian Brabandt,
closes #8498, closes #8260)
void
f_charclass(typval_T *argvars, typval_T *rettv UNUSED)
{
- if (check_for_string_arg(argvars, 0) == FAIL)
+ 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);
}
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()
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 3083,
/**/
3082,
/**/