]> granicus.if.org Git - vim/commitdiff
patch 8.2.3824: no ASAN support for MSVC v8.2.3824
authorYegappan Lakshmanan <yegappan@yahoo.com>
Thu, 16 Dec 2021 13:06:10 +0000 (13:06 +0000)
committerBram Moolenaar <Bram@vim.org>
Thu, 16 Dec 2021 13:06:10 +0000 (13:06 +0000)
Problem:    No ASAN support for MSVC.
Solution:   Add ASAN support and fix a coupld of uncovered problems. (Yegappan
            Lakshmanan, closes #9357)

src/Make_mvc.mak
src/findfile.c
src/os_mswin.c
src/testdir/test_fnamemodify.vim
src/version.c

index 6be13fba6bd70b764e27f74956bbda0eb69be788..2417d772704abc2d63ae24690018e8f4b08e45e3 100644 (file)
 #
 #      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"
index 4f457b9386e3dd7b29f94c82e077e61ee60c6bf5..ab5977697810436d37533bec5e9985f32afb05f8 100644 (file)
@@ -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
 
index 360c456e5cc924f3c46b046fadfa890b337147ae..b6393db5ab6713a6eb3165ce5bc428945973f84b 100644 (file)
@@ -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] == '\\')));
index 7882f3cb0dbcf5f62f5606db219b4beac6593e0a..dfe322afd19e1245c5f7412463348d9013daccb3 100644 (file)
@@ -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
 
index 0e7a67dfca6ba4ceb3ee525b0330470a0fd42b96..6576a55bd9a86ac675638578189ab0a68bae23a8 100644 (file)
@@ -749,6 +749,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3824,
 /**/
     3823,
 /**/