Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
patch 8.2.4938: crash when matching buffer with invalid pattern
Problem:    Crash when matching buffer with invalid pattern.
Solution:   Check for NULL regprog.
  • Loading branch information
brammool committed May 11, 2022
1 parent ead2415 commit a59f2df
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/buffer.c
Expand Up @@ -2932,7 +2932,7 @@ buflist_match(

// First try the short file name, then the long file name.
match = fname_match(rmp, buf->b_sfname, ignore_case);
if (match == NULL)
if (match == NULL && rmp->regprog != NULL)
match = fname_match(rmp, buf->b_ffname, ignore_case);

return match;
Expand Down
4 changes: 4 additions & 0 deletions src/testdir/test_buffer.vim
Expand Up @@ -415,6 +415,10 @@ func Test_buf_pattern_invalid()
vsplit 0000000
silent! buf [0--]\&\zs*\zs*e
bwipe!

vsplit 00000000000000000000000000
silent! buf [0--]\&\zs*\zs*e
bwipe!
endfunc

" Test for the 'maxmem' and 'maxmemtot' options
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -746,6 +746,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4938,
/**/
4937,
/**/
Expand Down

0 comments on commit a59f2df

Please sign in to comment.