summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2021-12-16 13:06:10 +0000
committerBram Moolenaar <Bram@vim.org>2021-12-16 13:06:10 +0000
commit6df0f2759d12ec0bc999b2963ecea4387a2bc516 (patch)
treee0123e1cb1c5270f76f16a4da69c74b903eff634
parent6ecf58b0d7d9b8fbba780d19d2e6c0f227df715b (diff)
patch 8.2.3824: no ASAN support for MSVCv8.2.3824
Problem: No ASAN support for MSVC. Solution: Add ASAN support and fix a coupld of uncovered problems. (Yegappan Lakshmanan, closes #9357)
-rw-r--r--src/Make_mvc.mak8
-rw-r--r--src/findfile.c2
-rw-r--r--src/os_mswin.c2
-rw-r--r--src/testdir/test_fnamemodify.vim1
-rw-r--r--src/version.c2
5 files changed, 14 insertions, 1 deletions
diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak
index 6be13fba6b..2417d77270 100644
--- a/src/Make_mvc.mak
+++ b/src/Make_mvc.mak
@@ -147,6 +147,8 @@
#
# Static Code Analysis: ANALYZE=yes (works with VS2012 or later)
#
+# Address Sanitizer: ASAN=yes (works with VS2019 or later)
+#
# You can combine any of these interfaces
#
# Example: To build the non-debug, GUI version with Perl interface:
@@ -662,6 +664,12 @@ CFLAGS = $(CFLAGS) -DHAVE_STDINT_H
CFLAGS = $(CFLAGS) /analyze
!endif
+# Address Sanitizer (ASAN) generally available starting with VS2019 version
+# 16.9
+!if ("$(ASAN)" == "yes") && ($(MSVC_MAJOR) >= 14)
+CFLAGS = $(CFLAGS) /fsanitize=address
+!endif
+
!ifdef NODEBUG
VIM = vim
! if "$(OPTIMIZE)" == "SPACE"
diff --git a/src/findfile.c b/src/findfile.c
index 4f457b9386..ab59776978 100644
--- a/src/findfile.c
+++ b/src/findfile.c
@@ -2653,7 +2653,7 @@ 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
diff --git a/src/os_mswin.c b/src/os_mswin.c
index 360c456e5c..b6393db5ab 100644
--- a/src/os_mswin.c
+++ b/src/os_mswin.c
@@ -389,6 +389,8 @@ mch_isFullName(char_u *fname)
// Another way to check is to use mch_FullName() and see if the result is
// the same as the name or mch_FullName() fails. However, this has quite a
// bit of overhead, so let's not do that.
+ if (*fname == NUL)
+ return TRUE;
return ((ASCII_ISALPHA(fname[0]) && fname[1] == ':'
&& (fname[2] == '/' || fname[2] == '\\'))
|| (fname[0] == fname[1] && (fname[0] == '/' || fname[0] == '\\')));
diff --git a/src/testdir/test_fnamemodify.vim b/src/testdir/test_fnamemodify.vim
index 7882f3cb0d..dfe322afd1 100644
--- a/src/testdir/test_fnamemodify.vim
+++ b/src/testdir/test_fnamemodify.vim
@@ -93,6 +93,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(test_null_string(), test_null_string()))
endfunc
diff --git a/src/version.c b/src/version.c
index 0e7a67dfca..6576a55bd9 100644
--- a/src/version.c
+++ b/src/version.c
@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3824,
+/**/
3823,
/**/
3822,