mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.4847: crash when using uninitialized function pointer
Problem: Crash when using uninitialized function pointer. Solution: Check for NULL pointer. (closes #10319, closes #10319)
This commit is contained in:
@@ -5314,7 +5314,8 @@ echo_string_core(
|
|||||||
|
|
||||||
if (echo_style)
|
if (echo_style)
|
||||||
{
|
{
|
||||||
r = make_ufunc_name_readable(tv->vval.v_string,
|
r = tv->vval.v_string == NULL ? (char_u *)"function()"
|
||||||
|
: make_ufunc_name_readable(tv->vval.v_string,
|
||||||
buf, MAX_FUNC_NAME_LEN);
|
buf, MAX_FUNC_NAME_LEN);
|
||||||
if (r == buf)
|
if (r == buf)
|
||||||
{
|
{
|
||||||
|
@@ -4115,6 +4115,38 @@ def Run_Test_misplaced_type()
|
|||||||
delete('XTest_misplaced_type')
|
delete('XTest_misplaced_type')
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
" Ensure echo doesn't crash when stringifying empty variables.
|
||||||
|
def Test_echo_uninit_variables()
|
||||||
|
var res: string
|
||||||
|
|
||||||
|
var var_bool: bool
|
||||||
|
var var_num: number
|
||||||
|
var var_float: float
|
||||||
|
var Var_func: func
|
||||||
|
var var_string: string
|
||||||
|
var var_blob: blob
|
||||||
|
var var_job: job
|
||||||
|
var var_channel: channel
|
||||||
|
var var_list: list<any>
|
||||||
|
var var_dict: dict<any>
|
||||||
|
|
||||||
|
redir => res
|
||||||
|
echo var_bool
|
||||||
|
echo var_num
|
||||||
|
echo var_float
|
||||||
|
echo Var_func
|
||||||
|
echo var_string
|
||||||
|
echo var_blob
|
||||||
|
echo var_job
|
||||||
|
echo var_channel
|
||||||
|
echo var_list
|
||||||
|
echo var_dict
|
||||||
|
redir END
|
||||||
|
|
||||||
|
assert_equal(['false', '0', '0.0', 'function()', '', '0z', 'no process',
|
||||||
|
'channel fail', '[]', '{}'], res->split('\n'))
|
||||||
|
enddef
|
||||||
|
|
||||||
" Keep this last, it messes up highlighting.
|
" Keep this last, it messes up highlighting.
|
||||||
def Test_substitute_cmd()
|
def Test_substitute_cmd()
|
||||||
new
|
new
|
||||||
|
@@ -746,6 +746,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 */
|
||||||
|
/**/
|
||||||
|
4847,
|
||||||
/**/
|
/**/
|
||||||
4846,
|
4846,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user