Mercurial > vim
changeset 27784:bfce04a99561 v8.2.4418
patch 8.2.4418: crash when using special multi-byte character
Commit: https://github.com/vim/vim/commit/5921aeb5741fc6e84c870d68c7c35b93ad0c9f87
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 19 11:20:12 2022 +0000
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 19 Feb 2022 12:30:04 +0100 |
parents | 59ce43efd4be |
children | 309353f3efd3 |
files | src/charset.c src/filepath.c src/proto/charset.pro src/testdir/test_autochdir.vim src/version.c |
diffstat | 5 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/charset.c +++ b/src/charset.c @@ -1645,6 +1645,12 @@ vim_isupper(int c) } int +vim_isalpha(int c) +{ + return vim_islower(c) || vim_isupper(c); +} + + int vim_toupper(int c) { if (c <= '@')
--- a/src/filepath.c +++ b/src/filepath.c @@ -3626,7 +3626,7 @@ unix_expandpath( else if (path_end >= path + wildoff && (vim_strchr((char_u *)"*?[{~$", *path_end) != NULL || (!p_fic && (flags & EW_ICASE) - && isalpha(PTR2CHAR(path_end))))) + && vim_isalpha(PTR2CHAR(path_end))))) e = p; if (has_mbyte) {
--- a/src/proto/charset.pro +++ b/src/proto/charset.pro @@ -50,6 +50,7 @@ int vim_isxdigit(int c); int vim_isbdigit(int c); int vim_islower(int c); int vim_isupper(int c); +int vim_isalpha(int c); int vim_toupper(int c); int vim_tolower(int c); char_u *skiptowhite(char_u *p); @@ -63,5 +64,4 @@ int hexhex2nr(char_u *p); int rem_backslash(char_u *str); void backslash_halve(char_u *p); char_u *backslash_halve_save(char_u *p); -void ebcdic2ascii(char_u *buffer, int len); /* vim: set ft=c : */
--- a/src/testdir/test_autochdir.vim +++ b/src/testdir/test_autochdir.vim @@ -110,4 +110,12 @@ func Test_verbose_pwd() call delete('Xautodir', 'rf') endfunc +func Test_multibyte() + " using an invalid character should not cause a crash + set wic + call assert_fails('tc *', 'E344:') + set nowic +endfunc + + " vim: shiftwidth=2 sts=2 expandtab