forked from aniani/vim
patch 8.2.3611: crash when using CTRL-W f without finding a file name
Problem: Crash when using CTRL-W f without finding a file name. Solution: Bail out when the file name length is zero.
This commit is contained in:
@@ -1735,6 +1735,9 @@ find_file_in_path_option(
|
|||||||
proc->pr_WindowPtr = (APTR)-1L;
|
proc->pr_WindowPtr = (APTR)-1L;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
if (len == 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (first == TRUE)
|
if (first == TRUE)
|
||||||
{
|
{
|
||||||
// copy file name into NameBuff, expanding environment variables
|
// copy file name into NameBuff, expanding environment variables
|
||||||
@@ -2118,7 +2121,12 @@ find_file_name_in_path(
|
|||||||
int c;
|
int c;
|
||||||
# if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
|
# if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
|
||||||
char_u *tofree = NULL;
|
char_u *tofree = NULL;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
if (len == 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
# if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
|
||||||
if ((options & FNAME_INCL) && *curbuf->b_p_inex != NUL)
|
if ((options & FNAME_INCL) && *curbuf->b_p_inex != NUL)
|
||||||
{
|
{
|
||||||
tofree = eval_includeexpr(ptr, len);
|
tofree = eval_includeexpr(ptr, len);
|
||||||
|
@@ -3881,8 +3881,10 @@ get_visual_text(
|
|||||||
*pp = ml_get_pos(&VIsual);
|
*pp = ml_get_pos(&VIsual);
|
||||||
*lenp = curwin->w_cursor.col - VIsual.col + 1;
|
*lenp = curwin->w_cursor.col - VIsual.col + 1;
|
||||||
}
|
}
|
||||||
if (has_mbyte)
|
if (**pp == NUL)
|
||||||
// Correct the length to include the whole last character.
|
*lenp = 0;
|
||||||
|
if (has_mbyte && *lenp > 0)
|
||||||
|
// Correct the length to include all bytes of the last character.
|
||||||
*lenp += (*mb_ptr2len)(*pp + (*lenp - 1)) - 1;
|
*lenp += (*mb_ptr2len)(*pp + (*lenp - 1)) - 1;
|
||||||
}
|
}
|
||||||
reset_VIsual_and_resel();
|
reset_VIsual_and_resel();
|
||||||
|
@@ -1265,6 +1265,14 @@ func Test_visual_block_with_virtualedit()
|
|||||||
call delete('XTest_block')
|
call delete('XTest_block')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_visual_block_ctrl_w_f()
|
||||||
|
" Emtpy block selected in new buffer should not result in an error.
|
||||||
|
au! BufNew foo sil norm f
|
||||||
|
edit foo
|
||||||
|
|
||||||
|
au! BufNew
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_visual_reselect_with_count()
|
func Test_visual_reselect_with_count()
|
||||||
" this was causing an illegal memory access
|
" this was causing an illegal memory access
|
||||||
let lines =<< trim END
|
let lines =<< trim END
|
||||||
|
@@ -757,6 +757,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 */
|
||||||
|
/**/
|
||||||
|
3611,
|
||||||
/**/
|
/**/
|
||||||
3610,
|
3610,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user