mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.4938: crash when matching buffer with invalid pattern
Problem: Crash when matching buffer with invalid pattern.
Solution: Check for NULL regprog.
a59f2dfd0c
This commit is contained in:
parent
0019886a84
commit
6f52bc5dee
@ -2366,7 +2366,7 @@ static char_u *buflist_match(regmatch_T *rmp, buf_T *buf, bool ignore_case)
|
|||||||
{
|
{
|
||||||
// First try the short file name, then the long file name.
|
// First try the short file name, then the long file name.
|
||||||
char_u *match = fname_match(rmp, buf->b_sfname, ignore_case);
|
char_u *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;
|
||||||
|
@ -66,6 +66,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
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
Loading…
Reference in New Issue
Block a user