]> git.pld-linux.org Git - packages/vim.git/blame - 7.2.239
- up to 7.2.436
[packages/vim.git] / 7.2.239
CommitLineData
215db38d
AG
1To: vim-dev@vim.org
2Subject: Patch 7.2.239
3Fcc: outbox
4From: Bram Moolenaar <Bram@moolenaar.net>
5Mime-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8------------
9
10Patch 7.2.239
11Problem: Using :diffpatch twice or when patching fails causes memory
12 corruption and/or a crash. (Bryan Venteicher)
13Solution: Detect missing output file. Avoid using non-existing buffer.
14Files: src/diff.c
15
16
17*** ../vim-7.2.238/src/diff.c 2009-05-14 22:19:19.000000000 +0200
18--- src/diff.c 2009-07-22 16:06:21.000000000 +0200
19***************
20*** 893,898 ****
21--- 893,899 ----
22 char_u *browseFile = NULL;
23 int browse_flag = cmdmod.browse;
24 #endif
25+ struct stat st;
26
27 #ifdef FEAT_BROWSE
28 if (cmdmod.browse)
29***************
30*** 999,1042 ****
31 STRCAT(buf, ".rej");
32 mch_remove(buf);
33
34! if (curbuf->b_fname != NULL)
35 {
36! newname = vim_strnsave(curbuf->b_fname,
37 (int)(STRLEN(curbuf->b_fname) + 4));
38! if (newname != NULL)
39! STRCAT(newname, ".new");
40! }
41
42 #ifdef FEAT_GUI
43! need_mouse_correct = TRUE;
44 #endif
45! /* don't use a new tab page, each tab page has its own diffs */
46! cmdmod.tab = 0;
47!
48! if (win_split(0, (diff_flags & DIFF_VERTICAL) ? WSP_VERT : 0) != FAIL)
49! {
50! /* Pretend it was a ":split fname" command */
51! eap->cmdidx = CMD_split;
52! eap->arg = tmp_new;
53! do_exedit(eap, old_curwin);
54
55! if (curwin != old_curwin) /* split must have worked */
56 {
57! /* Set 'diff', 'scrollbind' on and 'wrap' off. */
58! diff_win_options(curwin, TRUE);
59! diff_win_options(old_curwin, TRUE);
60
61! if (newname != NULL)
62 {
63! /* do a ":file filename.new" on the patched buffer */
64! eap->arg = newname;
65! ex_file(eap);
66
67 #ifdef FEAT_AUTOCMD
68! /* Do filetype detection with the new name. */
69! if (au_has_group((char_u *)"filetypedetect"))
70! do_cmdline_cmd((char_u *)":doau filetypedetect BufRead");
71 #endif
72 }
73 }
74 }
75--- 1000,1050 ----
76 STRCAT(buf, ".rej");
77 mch_remove(buf);
78
79! /* Only continue if the output file was created. */
80! if (mch_stat((char *)tmp_new, &st) < 0 || st.st_size == 0)
81! EMSG(_("E816: Cannot read patch output"));
82! else
83 {
84! if (curbuf->b_fname != NULL)
85! {
86! newname = vim_strnsave(curbuf->b_fname,
87 (int)(STRLEN(curbuf->b_fname) + 4));
88! if (newname != NULL)
89! STRCAT(newname, ".new");
90! }
91
92 #ifdef FEAT_GUI
93! need_mouse_correct = TRUE;
94 #endif
95! /* don't use a new tab page, each tab page has its own diffs */
96! cmdmod.tab = 0;
97
98! if (win_split(0, (diff_flags & DIFF_VERTICAL) ? WSP_VERT : 0) != FAIL)
99 {
100! /* Pretend it was a ":split fname" command */
101! eap->cmdidx = CMD_split;
102! eap->arg = tmp_new;
103! do_exedit(eap, old_curwin);
104
105! /* check that split worked and editing tmp_new */
106! if (curwin != old_curwin && win_valid(old_curwin))
107 {
108! /* Set 'diff', 'scrollbind' on and 'wrap' off. */
109! diff_win_options(curwin, TRUE);
110! diff_win_options(old_curwin, TRUE);
111!
112! if (newname != NULL)
113! {
114! /* do a ":file filename.new" on the patched buffer */
115! eap->arg = newname;
116! ex_file(eap);
117
118 #ifdef FEAT_AUTOCMD
119! /* Do filetype detection with the new name. */
120! if (au_has_group((char_u *)"filetypedetect"))
121! do_cmdline_cmd((char_u *)":doau filetypedetect BufRead");
122 #endif
123+ }
124 }
125 }
126 }
127*** ../vim-7.2.238/src/version.c 2009-07-22 14:27:33.000000000 +0200
128--- src/version.c 2009-07-22 16:21:29.000000000 +0200
129***************
130*** 678,679 ****
131--- 678,681 ----
132 { /* Add new patch number below this line */
133+ /**/
134+ 239,
135 /**/
136
137--
138hundred-and-one symptoms of being an internet addict:
13997. Your mother tells you to remember something, and you look for
140 a File/Save command.
141
142 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
143/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
144\\\ download, build and distribute -- http://www.A-A-P.org ///
145 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
This page took 0.040023 seconds and 4 git commands to generate.