aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-02-07 06:48:10 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-02-07 06:48:10 +0800
commitbfc11e9c64f7da952fb3f6c0ee0f62d80ce4394a (patch)
tree2fcfe500ae59be821da44c7d5a9aa1ab334f1e78
parent53e4434c722d94f9c49dee2fd787d05d36a46bf3 (diff)
downloadrneovim-bfc11e9c64f7da952fb3f6c0ee0f62d80ce4394a.tar.gz
rneovim-bfc11e9c64f7da952fb3f6c0ee0f62d80ce4394a.tar.bz2
rneovim-bfc11e9c64f7da952fb3f6c0ee0f62d80ce4394a.zip
vim-patch:8.2.3824: no ASAN support for MSVC
Problem: No ASAN support for MSVC. Solution: Add ASAN support and fix a coupld of uncovered problems. (Yegappan Lakshmanan, closes vim/vim#9357) https://github.com/vim/vim/commit/6df0f2759d12ec0bc999b2963ecea4387a2bc516
-rw-r--r--src/nvim/path.c8
-rw-r--r--src/nvim/testdir/test_fnamemodify.vim1
2 files changed, 6 insertions, 3 deletions
diff --git a/src/nvim/path.c b/src/nvim/path.c
index fe564182d8..54170e7a8b 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -1521,7 +1521,7 @@ void simplify_filename(char_u *filename)
p = filename;
#ifdef BACKSLASH_IN_FILENAME
- if (p[1] == ':') { // skip "x:"
+ if (p[0] != NUL && p[1] == ':') { // skip "x:"
p += 2;
}
#endif
@@ -2402,9 +2402,11 @@ static int path_to_absolute(const char_u *fname, char_u *buf, size_t len, int fo
int path_is_absolute(const char_u *fname)
{
#ifdef WIN32
+ if (*fname == NUL) {
+ return true;
+ }
// A name like "d:/foo" and "//server/share" is absolute
- return ((isalpha(fname[0]) && fname[1] == ':'
- && vim_ispathsep_nocolon(fname[2]))
+ return ((isalpha(fname[0]) && fname[1] == ':' && vim_ispathsep_nocolon(fname[2]))
|| (vim_ispathsep_nocolon(fname[0]) && fname[0] == fname[1]));
#else
// UNIX: This just checks if the file name starts with '/' or '~'.
diff --git a/src/nvim/testdir/test_fnamemodify.vim b/src/nvim/testdir/test_fnamemodify.vim
index a8d513eede..73ede415ae 100644
--- a/src/nvim/testdir/test_fnamemodify.vim
+++ b/src/nvim/testdir/test_fnamemodify.vim
@@ -90,6 +90,7 @@ func Test_fnamemodify_er()
call assert_equal('b.c', fnamemodify('a.b.c.d.e', ':r:r:e:e:e'))
call assert_equal('b.c', fnamemodify('a.b.c.d.e', ':r:r:e:e:e:e'))
+ call assert_equal('', fnamemodify('', ':p:t'))
call assert_equal('', fnamemodify(v:_null_string, v:_null_string))
endfunc