]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
updated for version 7.3.701 v7.3.701
authorBram Moolenaar <Bram@vim.org>
Sun, 21 Oct 2012 00:37:10 +0000 (02:37 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 21 Oct 2012 00:37:10 +0000 (02:37 +0200)
Problem:    MS-Windows: Crash with stack overflow when setting 'encoding'.
Solution:   Handle that loading the iconv library may be called recursively.
            (Jiri Sedlak)

src/os_win32.c
src/version.c

index 8151e6054aee191a64e3a9e8fe7501b37a43fbeb..006a3614489d49f4c28cb9ea8dc156688808c562 100644 (file)
@@ -288,18 +288,26 @@ unescape_shellxquote(char_u *p, char_u *escaped)
 vimLoadLib(char *name)
 {
     HINSTANCE dll = NULL;
-    char old_dir[MAXPATHL];
+    TCHAR old_dir[MAXPATHL];
 
+    /* NOTE: Do not use mch_dirname() and mch_chdir() here, they may call
+     * vimLoadLib() recursively, which causes a stack overflow. */
     if (exe_path == NULL)
        get_exe_name();
-    if (exe_path != NULL && mch_dirname(old_dir, MAXPATHL) == OK)
+    if (exe_path != NULL && GetCurrentDirectory(MAXPATHL, old_dir) != 0)
     {
        /* Change directory to where the executable is, both to make sure we
         * find a .dll there and to avoid looking for a .dll in the current
         * directory. */
-       mch_chdir(exe_path);
+       SetCurrentDirectory(exe_path);
+       dll = LoadLibrary(name);
+       SetCurrentDirectory(old_dir);
+    }
+    else
+    {
+       /* We are not able to change directory to where the executable is, try
+        * to load library anyway. */
        dll = LoadLibrary(name);
-       mch_chdir(old_dir);
     }
     return dll;
 }
index cbe525cc241095f9ef42480dbadb8b72cb6efdf7..6afb9d16b34dec1b5e037c18c1434b590752b40c 100644 (file)
@@ -719,6 +719,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    701,
 /**/
     700,
 /**/