mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 11:15:14 -07:00
vim-patch:8.2.4901: NULL pointer access when using invalid pattern
Problem: NULL pointer access when using invalid pattern.
Solution: Check for failed regexp program.
8e4b76da1d
This commit is contained in:
parent
96a125b207
commit
0019886a84
@ -2387,7 +2387,7 @@ static char_u *fname_match(regmatch_T *rmp, char_u *name, bool ignore_case)
|
||||
rmp->rm_ic = p_fic || ignore_case;
|
||||
if (vim_regexec(rmp, name, (colnr_T)0)) {
|
||||
match = name;
|
||||
} else {
|
||||
} else if (rmp->regprog != NULL) {
|
||||
// Replace $(HOME) with '~' and try matching again.
|
||||
p = home_replace_save(NULL, name);
|
||||
if (vim_regexec(rmp, p, (colnr_T)0)) {
|
||||
|
@ -61,4 +61,11 @@ func Test_buffer_scheme()
|
||||
set shellslash&
|
||||
endfunc
|
||||
|
||||
" this was using a NULL pointer after failing to use the pattern
|
||||
func Test_buf_pattern_invalid()
|
||||
vsplit 0000000
|
||||
silent! buf [0--]\&\zs*\zs*e
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
Loading…
Reference in New Issue
Block a user