]>
Commit | Line | Data |
---|---|---|
1419a6f5 ER |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.3.009 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.3.009 | |
11 | Problem: Win32: Crash on Windows when using a bad argument for strftime(). | |
12 | (Christian Brabandt) | |
13 | Solution: Use the bad_param_handler(). (Mike Williams) | |
14 | Files: src/os_win32.c | |
15 | ||
16 | ||
17 | *** ../vim-7.3.008/src/os_win32.c 2010-08-15 21:57:27.000000000 +0200 | |
18 | --- src/os_win32.c 2010-09-21 17:02:54.000000000 +0200 | |
19 | *************** | |
20 | *** 1615,1620 **** | |
21 | --- 1615,1649 ---- | |
22 | return TRUE; | |
23 | } | |
24 | ||
25 | + #if ((defined(__MINGW32__) || defined (__CYGWIN32__)) && \ | |
26 | + __MSVCRT_VERSION__ >= 0x800) || (defined(_MSC_VER) && _MSC_VER >= 1400) | |
27 | + /* | |
28 | + * Bad parameter handler. | |
29 | + * | |
30 | + * Certain MS CRT functions will intentionally crash when passed invalid | |
31 | + * parameters to highlight possible security holes. Setting this function as | |
32 | + * the bad parameter handler will prevent the crash. | |
33 | + * | |
34 | + * In debug builds the parameters contain CRT information that might help track | |
35 | + * down the source of a problem, but in non-debug builds the arguments are all | |
36 | + * NULL/0. Debug builds will also produce assert dialogs from the CRT, it is | |
37 | + * worth allowing these to make debugging of issues easier. | |
38 | + */ | |
39 | + static void | |
40 | + bad_param_handler(const wchar_t *expression, | |
41 | + const wchar_t *function, | |
42 | + const wchar_t *file, | |
43 | + unsigned int line, | |
44 | + uintptr_t pReserved) | |
45 | + { | |
46 | + } | |
47 | + | |
48 | + # define SET_INVALID_PARAM_HANDLER \ | |
49 | + ((void)_set_invalid_parameter_handler(bad_param_handler)) | |
50 | + #else | |
51 | + # define SET_INVALID_PARAM_HANDLER | |
52 | + #endif | |
53 | + | |
54 | #ifdef FEAT_GUI_W32 | |
55 | ||
56 | /* | |
57 | *************** | |
58 | *** 1627,1632 **** | |
59 | --- 1656,1664 ---- | |
60 | extern int _fmode; | |
61 | #endif | |
62 | ||
63 | + /* Silently handle invalid parameters to CRT functions */ | |
64 | + SET_INVALID_PARAM_HANDLER; | |
65 | + | |
66 | /* Let critical errors result in a failure, not in a dialog box. Required | |
67 | * for the timestamp test to work on removed floppies. */ | |
68 | SetErrorMode(SEM_FAILCRITICALERRORS); | |
69 | *************** | |
70 | *** 2103,2108 **** | |
71 | --- 2135,2143 ---- | |
72 | extern int _fmode; | |
73 | #endif | |
74 | ||
75 | + /* Silently handle invalid parameters to CRT functions */ | |
76 | + SET_INVALID_PARAM_HANDLER; | |
77 | + | |
78 | /* Let critical errors result in a failure, not in a dialog box. Required | |
79 | * for the timestamp test to work on removed floppies. */ | |
80 | SetErrorMode(SEM_FAILCRITICALERRORS); | |
81 | *** ../vim-7.3.008/src/version.c 2010-09-21 16:56:29.000000000 +0200 | |
82 | --- src/version.c 2010-09-21 17:27:36.000000000 +0200 | |
83 | *************** | |
84 | *** 716,717 **** | |
85 | --- 716,719 ---- | |
86 | { /* Add new patch number below this line */ | |
87 | + /**/ | |
88 | + 9, | |
89 | /**/ | |
90 | ||
91 | -- | |
92 | Wizards had always known that the act of observation changed the thing that | |
93 | was observed, and sometimes forgot that it also changed the observer too. | |
94 | Terry Pratchett - Interesting times | |
95 | ||
96 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
97 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
98 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
99 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |