Skip to content

Commit 0fa7326

Browse files
committed
updated for version 7.3.701
Problem: MS-Windows: Crash with stack overflow when setting 'encoding'. Solution: Handle that loading the iconv library may be called recursively. (Jiri Sedlak)
1 parent ffb1760 commit 0fa7326

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/os_win32.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,18 +288,26 @@ unescape_shellxquote(char_u *p, char_u *escaped)
288288
vimLoadLib(char *name)
289289
{
290290
HINSTANCE dll = NULL;
291-
char old_dir[MAXPATHL];
291+
TCHAR old_dir[MAXPATHL];
292292

293+
/* NOTE: Do not use mch_dirname() and mch_chdir() here, they may call
294+
* vimLoadLib() recursively, which causes a stack overflow. */
293295
if (exe_path == NULL)
294296
get_exe_name();
295-
if (exe_path != NULL && mch_dirname(old_dir, MAXPATHL) == OK)
297+
if (exe_path != NULL && GetCurrentDirectory(MAXPATHL, old_dir) != 0)
296298
{
297299
/* Change directory to where the executable is, both to make sure we
298300
* find a .dll there and to avoid looking for a .dll in the current
299301
* directory. */
300-
mch_chdir(exe_path);
302+
SetCurrentDirectory(exe_path);
303+
dll = LoadLibrary(name);
304+
SetCurrentDirectory(old_dir);
305+
}
306+
else
307+
{
308+
/* We are not able to change directory to where the executable is, try
309+
* to load library anyway. */
301310
dll = LoadLibrary(name);
302-
mch_chdir(old_dir);
303311
}
304312
return dll;
305313
}

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,8 @@ static char *(features[]) =
719719

720720
static int included_patches[] =
721721
{ /* Add new patch number below this line */
722+
/**/
723+
701,
722724
/**/
723725
700,
724726
/**/

0 commit comments

Comments
 (0)