0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.4938: crash when matching buffer with invalid pattern

Problem:    Crash when matching buffer with invalid pattern.
Solution:   Check for NULL regprog.
This commit is contained in:
Bram Moolenaar
2022-05-11 11:42:28 +01:00
parent ead241538c
commit a59f2dfd0c
3 changed files with 7 additions and 1 deletions

View File

@@ -2932,7 +2932,7 @@ buflist_match(
// First try the short file name, then the long file name. // First try the short file name, then the long file name.
match = fname_match(rmp, buf->b_sfname, ignore_case); 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); match = fname_match(rmp, buf->b_ffname, ignore_case);
return match; return match;

View File

@@ -415,6 +415,10 @@ func Test_buf_pattern_invalid()
vsplit 0000000 vsplit 0000000
silent! buf [0--]\&\zs*\zs*e silent! buf [0--]\&\zs*\zs*e
bwipe! bwipe!
vsplit 00000000000000000000000000
silent! buf [0--]\&\zs*\zs*e
bwipe!
endfunc endfunc
" Test for the 'maxmem' and 'maxmemtot' options " Test for the 'maxmem' and 'maxmemtot' options

View File

@@ -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 */
/**/
4938,
/**/ /**/
4937, 4937,
/**/ /**/