mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.4418: crash when using special multi-byte character
Problem: Crash when using special multi-byte character.
Solution: Don't use isalpha() for an arbitrary character.
5921aeb574
Rename vim_isalpha to mb_isalpha.
This commit is contained in:
parent
30bf40ec4b
commit
9f4401897a
@ -1317,6 +1317,12 @@ bool mb_isupper(int a)
|
||||
return mb_tolower(a) != a;
|
||||
}
|
||||
|
||||
bool mb_isalpha(int a)
|
||||
FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
return mb_islower(a) || mb_isupper(a);
|
||||
}
|
||||
|
||||
static int utf_strnicmp(const char_u *s1, const char_u *s2, size_t n1, size_t n2)
|
||||
{
|
||||
int c1, c2, cdiff;
|
||||
|
@ -642,8 +642,7 @@ static size_t do_path_expand(garray_T *gap, const char_u *path, size_t wildoff,
|
||||
} else if (path_end >= path + wildoff
|
||||
&& (vim_strchr((char_u *)"*?[{~$", *path_end) != NULL
|
||||
#ifndef WIN32
|
||||
|| (!p_fic && (flags & EW_ICASE)
|
||||
&& isalpha(utf_ptr2char(path_end)))
|
||||
|| (!p_fic && (flags & EW_ICASE) && mb_isalpha(utf_ptr2char(path_end)))
|
||||
#endif
|
||||
)) {
|
||||
e = p;
|
||||
|
@ -64,4 +64,14 @@ func Test_verbose_pwd()
|
||||
call delete('Xautodir', 'rf')
|
||||
endfunc
|
||||
|
||||
func Test_multibyte()
|
||||
" using an invalid character should not cause a crash
|
||||
set wic
|
||||
" E344 is thrown first, but v8.1.1183 hasn't been ported yet
|
||||
" call assert_fails('tc û<><C3BB><EFBFBD>¦*', 'E344:')
|
||||
call assert_fails('tc û<><C3BB><EFBFBD>¦*', 'E472:')
|
||||
set nowic
|
||||
endfunc
|
||||
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
Loading…
Reference in New Issue
Block a user