summaryrefslogtreecommitdiff
path: root/source/ap/vim/patches/7.3.009
blob: 317677d02a65c9c30fbbe9c38a7ced11e23d3e87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
To: vim-dev@vim.org
Subject: Patch 7.3.009
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.009
Problem:    Win32: Crash on Windows when using a bad argument for strftime().
	    (Christian Brabandt)
Solution:   Use the bad_param_handler(). (Mike Williams)
Files:	    src/os_win32.c


*** ../vim-7.3.008/src/os_win32.c	2010-08-15 21:57:27.000000000 +0200
--- src/os_win32.c	2010-09-21 17:02:54.000000000 +0200
***************
*** 1615,1620 ****
--- 1615,1649 ----
      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,1632 ****
--- 1656,1664 ----
      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,2108 ****
--- 2135,2143 ----
      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);
*** ../vim-7.3.008/src/version.c	2010-09-21 16:56:29.000000000 +0200
--- src/version.c	2010-09-21 17:27:36.000000000 +0200
***************
*** 716,717 ****
--- 716,719 ----
  {   /* Add new patch number below this line */
+ /**/
+     9,
  /**/

-- 
Wizards had always known that the act of observation changed the thing that
was observed, and sometimes forgot that it also changed the observer too.
			Terry Pratchett  -  Interesting times

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///