To: vim_dev@googlegroups.com
Subject: Patch 7.3.701
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 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)
Files: src/os_win32.c
*** ../vim-7.3.700/src/os_win32.c 2012-08-02 12:31:40.000000000 +0200
--- src/os_win32.c 2012-10-21 02:35:21.000000000 +0200
***************
*** 288,305 ****
vimLoadLib(char *name)
{
HINSTANCE dll = NULL;
! char old_dir[MAXPATHL];
if (exe_path == NULL)
get_exe_name();
! if (exe_path != NULL && mch_dirname(old_dir, MAXPATHL) == OK)
{
/* 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);
dll = LoadLibrary(name);
- mch_chdir(old_dir);
}
return dll;
}
--- 288,313 ----
vimLoadLib(char *name)
{
HINSTANCE dll = NULL;
! 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 && 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. */
! 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);
}
return dll;
}
*** ../vim-7.3.700/src/version.c 2012-10-21 02:17:28.000000000 +0200
--- src/version.c 2012-10-21 02:35:48.000000000 +0200
***************
*** 721,722 ****
--- 721,724 ----
{ /* Add new patch number below this line */
+ /**/
+ 701,
/**/
--
BEDEVERE: And that, my lord, is how we know the Earth to be banana-shaped.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///