]>
Commit | Line | Data |
---|---|---|
c936e692 AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.2.279 | |
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.2.279 | |
11 | Problem: Invalid memory read with visual mode "r". (Dominique Pelle) | |
12 | Solution: Make sure the cursor position is valid. Don't check the cursor | |
13 | position but the position being used. And make sure we get the | |
14 | right line. | |
15 | Files: src/misc2.c, src/ops.c | |
16 | ||
17 | ||
18 | *** ../vim-7.2.278/src/misc2.c 2009-05-16 21:06:36.000000000 +0200 | |
19 | --- src/misc2.c 2009-11-03 16:43:10.000000000 +0100 | |
20 | *************** | |
21 | *** 156,162 **** | |
22 | || ((ve_flags & VE_ONEMORE) && wcol < MAXCOL) | |
23 | #endif | |
24 | ; | |
25 | ! line = ml_get_curline(); | |
26 | ||
27 | if (wcol >= MAXCOL) | |
28 | { | |
29 | --- 156,162 ---- | |
30 | || ((ve_flags & VE_ONEMORE) && wcol < MAXCOL) | |
31 | #endif | |
32 | ; | |
33 | ! line = ml_get_buf(curbuf, pos->lnum, FALSE); | |
34 | ||
35 | if (wcol >= MAXCOL) | |
36 | { | |
37 | *************** | |
38 | *** 332,340 **** | |
39 | #endif | |
40 | ||
41 | #ifdef FEAT_MBYTE | |
42 | ! /* prevent cursor from moving on the trail byte */ | |
43 | if (has_mbyte) | |
44 | ! mb_adjust_cursor(); | |
45 | #endif | |
46 | ||
47 | if (col < wcol) | |
48 | --- 332,340 ---- | |
49 | #endif | |
50 | ||
51 | #ifdef FEAT_MBYTE | |
52 | ! /* prevent from moving onto a trail byte */ | |
53 | if (has_mbyte) | |
54 | ! mb_adjustpos(pos); | |
55 | #endif | |
56 | ||
57 | if (col < wcol) | |
58 | *** ../vim-7.2.278/src/ops.c 2009-09-30 15:15:33.000000000 +0200 | |
59 | --- src/ops.c 2009-11-03 15:18:50.000000000 +0100 | |
60 | *************** | |
61 | *** 2020,2025 **** | |
62 | --- 2020,2026 ---- | |
63 | bd.is_MAX = (curwin->w_curswant == MAXCOL); | |
64 | for ( ; curwin->w_cursor.lnum <= oap->end.lnum; ++curwin->w_cursor.lnum) | |
65 | { | |
66 | + curwin->w_cursor.col = 0; /* make sure cursor position is valid */ | |
67 | block_prep(oap, &bd, curwin->w_cursor.lnum, TRUE); | |
68 | if (bd.textlen == 0 && (!virtual_op || bd.is_MAX)) | |
69 | continue; /* nothing to replace */ | |
70 | *************** | |
71 | *** 2035,2040 **** | |
72 | --- 2036,2042 ---- | |
73 | { | |
74 | pos_T vpos; | |
75 | ||
76 | + vpos.lnum = curwin->w_cursor.lnum; | |
77 | getvpos(&vpos, oap->start_vcol); | |
78 | bd.startspaces += vpos.coladd; | |
79 | n = bd.startspaces; | |
80 | *************** | |
81 | *** 2693,2703 **** | |
82 | * initial coladd offset as part of "startspaces" */ | |
83 | if (bd.is_short) | |
84 | { | |
85 | ! linenr_T lnum = curwin->w_cursor.lnum; | |
86 | ! | |
87 | ! curwin->w_cursor.lnum = linenr; | |
88 | (void)getvpos(&vpos, oap->start_vcol); | |
89 | - curwin->w_cursor.lnum = lnum; | |
90 | } | |
91 | else | |
92 | vpos.coladd = 0; | |
93 | --- 2695,2702 ---- | |
94 | * initial coladd offset as part of "startspaces" */ | |
95 | if (bd.is_short) | |
96 | { | |
97 | ! vpos.lnum = linenr; | |
98 | (void)getvpos(&vpos, oap->start_vcol); | |
99 | } | |
100 | else | |
101 | vpos.coladd = 0; | |
102 | *** ../vim-7.2.278/src/version.c 2009-11-03 16:29:48.000000000 +0100 | |
103 | --- src/version.c 2009-11-03 16:41:53.000000000 +0100 | |
104 | *************** | |
105 | *** 678,679 **** | |
106 | --- 678,681 ---- | |
107 | { /* Add new patch number below this line */ | |
108 | + /**/ | |
109 | + 279, | |
110 | /**/ | |
111 | ||
112 | -- | |
113 | BEDEVERE: How do you know so much about swallows? | |
114 | ARTHUR: Well you have to know these things when you're a king, you know. | |
115 | "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD | |
116 | ||
117 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
118 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
119 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
120 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |