mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 8.2.2848: crash whn calling partial
Problem: Crash whn calling partial. Solution: Check for NULL pointer. (Dominique Pellé, closes #8202)
This commit is contained in:
committed by
Bram Moolenaar
parent
588cf7547b
commit
fe8ebdbe5c
11
src/eval.c
11
src/eval.c
@@ -4284,10 +4284,13 @@ eval_index_inner(
|
|||||||
char_u *
|
char_u *
|
||||||
partial_name(partial_T *pt)
|
partial_name(partial_T *pt)
|
||||||
{
|
{
|
||||||
if (pt->pt_name != NULL)
|
if (pt != NULL)
|
||||||
return pt->pt_name;
|
{
|
||||||
if (pt->pt_func != NULL)
|
if (pt->pt_name != NULL)
|
||||||
return pt->pt_func->uf_name;
|
return pt->pt_name;
|
||||||
|
if (pt->pt_func != NULL)
|
||||||
|
return pt->pt_func->uf_name;
|
||||||
|
}
|
||||||
return (char_u *)"";
|
return (char_u *)"";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1971,7 +1971,7 @@ internal_func_name(int idx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check the argument types for builting function "idx".
|
* Check the argument types for builtin function "idx".
|
||||||
* Uses the list of types on the type stack: "types".
|
* Uses the list of types on the type stack: "types".
|
||||||
* Return FAIL and gives an error message when a type is wrong.
|
* Return FAIL and gives an error message when a type is wrong.
|
||||||
*/
|
*/
|
||||||
@@ -2475,8 +2475,8 @@ f_call(typval_T *argvars, typval_T *rettv)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
func = tv_get_string(&argvars[0]);
|
func = tv_get_string(&argvars[0]);
|
||||||
if (*func == NUL)
|
if (func == NULL || *func == NUL)
|
||||||
return; // type error or empty name
|
return; // type error, empty name or null function
|
||||||
|
|
||||||
if (argvars[2].v_type != VAR_UNKNOWN)
|
if (argvars[2].v_type != VAR_UNKNOWN)
|
||||||
{
|
{
|
||||||
@@ -2779,7 +2779,7 @@ f_cosh(typval_T *argvars, typval_T *rettv)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the cursor position.
|
* Set the cursor position.
|
||||||
* If 'charcol' is TRUE, then use the column number as a character offet.
|
* If 'charcol' is TRUE, then use the column number as a character offset.
|
||||||
* Otherwise use the column number as a byte offset.
|
* Otherwise use the column number as a byte offset.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
|
@@ -2150,6 +2150,10 @@ func Test_call()
|
|||||||
eval mydict.len->call([], mydict)->assert_equal(4)
|
eval mydict.len->call([], mydict)->assert_equal(4)
|
||||||
call assert_fails("call call('Mylen', [], 0)", 'E715:')
|
call assert_fails("call call('Mylen', [], 0)", 'E715:')
|
||||||
call assert_fails('call foo', 'E107:')
|
call assert_fails('call foo', 'E107:')
|
||||||
|
|
||||||
|
" This once caused a crash.
|
||||||
|
call call(test_null_function(), [])
|
||||||
|
call call(test_null_partial(), [])
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_char2nr()
|
func Test_char2nr()
|
||||||
|
@@ -743,6 +743,7 @@ func Test_reduce()
|
|||||||
|
|
||||||
" should not crash
|
" should not crash
|
||||||
call assert_fails('echo reduce([1], test_null_function())', 'E1132:')
|
call assert_fails('echo reduce([1], test_null_function())', 'E1132:')
|
||||||
|
call assert_fails('echo reduce([1], test_null_partial())', 'E1132:')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" splitting a string to a List using split()
|
" splitting a string to a List using split()
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2848,
|
||||||
/**/
|
/**/
|
||||||
2847,
|
2847,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user