summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <bram@vim.org>2010-09-21 17:29:23 +0200
committerBram Moolenaar <bram@vim.org>2010-09-21 17:29:23 +0200
commit8a2717f71f713ee9037562424c8f10f1ad6d0501 (patch)
treeb648039723a8f446d262033849834ea1bf075dcd
parent5a3e5f32b11bc04973fd3301755652a6fafbf392 (diff)
downloadvim-8a2717f71f713ee9037562424c8f10f1ad6d0501.tar.gz
updated for version 7.3.009v7.3.009v7-3-009
Problem: Win32: Crash on Windows when using a bad argument for strftime(). (Christian Brabandt) Solution: Use the bad_param_handler(). (Mike Williams)
-rw-r--r--src/os_win32.c35
-rw-r--r--src/version.c2
2 files changed, 37 insertions, 0 deletions
diff --git a/src/os_win32.c b/src/os_win32.c
index 8529afbc..8c59e099 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -1615,6 +1615,35 @@ executable_exists(char *name)
return TRUE;
}
+#if ((defined(__MINGW32__) || defined (__CYGWIN32__)) && \
+ __MSVCRT_VERSION__ >= 0x800) || (defined(_MSC_VER) && _MSC_VER >= 1400)
+/*
+ * Bad parameter handler.
+ *
+ * Certain MS CRT functions will intentionally crash when passed invalid
+ * parameters to highlight possible security holes. Setting this function as
+ * the bad parameter handler will prevent the crash.
+ *
+ * In debug builds the parameters contain CRT information that might help track
+ * down the source of a problem, but in non-debug builds the arguments are all
+ * NULL/0. Debug builds will also produce assert dialogs from the CRT, it is
+ * worth allowing these to make debugging of issues easier.
+ */
+ static void
+bad_param_handler(const wchar_t *expression,
+ const wchar_t *function,
+ const wchar_t *file,
+ unsigned int line,
+ uintptr_t pReserved)
+{
+}
+
+# define SET_INVALID_PARAM_HANDLER \
+ ((void)_set_invalid_parameter_handler(bad_param_handler))
+#else
+# define SET_INVALID_PARAM_HANDLER
+#endif
+
#ifdef FEAT_GUI_W32
/*
@@ -1627,6 +1656,9 @@ mch_init(void)
extern int _fmode;
#endif
+ /* Silently handle invalid parameters to CRT functions */
+ SET_INVALID_PARAM_HANDLER;
+
/* Let critical errors result in a failure, not in a dialog box. Required
* for the timestamp test to work on removed floppies. */
SetErrorMode(SEM_FAILCRITICALERRORS);
@@ -2103,6 +2135,9 @@ mch_init(void)
extern int _fmode;
#endif
+ /* Silently handle invalid parameters to CRT functions */
+ SET_INVALID_PARAM_HANDLER;
+
/* Let critical errors result in a failure, not in a dialog box. Required
* for the timestamp test to work on removed floppies. */
SetErrorMode(SEM_FAILCRITICALERRORS);
diff --git a/src/version.c b/src/version.c
index d4a22da8..2898be8e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -715,6 +715,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 9,
+/**/
8,
/**/
7,