Patch 8.2.4847

9 views
Skip to first unread message

Bram Moolenaar

unread,
Apr 29, 2022, 4:16:22 PM4/29/22
to vim...@googlegroups.com

Patch 8.2.4847
Problem: Crash when using uninitialized function pointer.
Solution: Check for NULL pointer. (closes #10319, closes #10319)
Files: src/eval.c, src/testdir/test_vim9_script.vim


*** ../vim-8.2.4846/src/eval.c 2022-04-24 21:54:56.061612118 +0100
--- src/eval.c 2022-04-29 21:05:26.125852684 +0100
***************
*** 5314,5320 ****

if (echo_style)
{
! r = make_ufunc_name_readable(tv->vval.v_string,
buf, MAX_FUNC_NAME_LEN);
if (r == buf)
{
--- 5314,5321 ----

if (echo_style)
{
! r = tv->vval.v_string == NULL ? (char_u *)"function()"
! : make_ufunc_name_readable(tv->vval.v_string,
buf, MAX_FUNC_NAME_LEN);
if (r == buf)
{
*** ../vim-8.2.4846/src/testdir/test_vim9_script.vim 2022-04-27 22:15:35.992839061 +0100
--- src/testdir/test_vim9_script.vim 2022-04-29 21:06:09.441800074 +0100
***************
*** 4115,4120 ****
--- 4115,4152 ----
delete('XTest_misplaced_type')
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.
def Test_substitute_cmd()
new
*** ../vim-8.2.4846/src/version.c 2022-04-29 16:43:56.219178196 +0100
--- src/version.c 2022-04-29 20:41:53.235936844 +0100
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4847,
/**/

--
How many light bulbs does it take to change a person?

/// Bram Moolenaar -- Br...@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 ///
Reply all
Reply to author
Forward
0 new messages