summaryrefslogtreecommitdiff
path: root/source/ap/vim/patches/7.2.279
blob: bdf58fc8e1500b42d0b8878ca91ce0fc67a8a9e3 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
To: vim-dev@vim.org
Subject: Patch 7.2.279
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.2.279
Problem:    Invalid memory read with visual mode "r". (Dominique Pelle)
Solution:   Make sure the cursor position is valid.  Don't check the cursor
	    position but the position being used.  And make sure we get the
	    right line.
Files:	    src/misc2.c, src/ops.c


*** ../vim-7.2.278/src/misc2.c	2009-05-16 21:06:36.000000000 +0200
--- src/misc2.c	2009-11-03 16:43:10.000000000 +0100
***************
*** 156,162 ****
  		    || ((ve_flags & VE_ONEMORE) && wcol < MAXCOL)
  #endif
  		    ;
!     line = ml_get_curline();
  
      if (wcol >= MAXCOL)
      {
--- 156,162 ----
  		    || ((ve_flags & VE_ONEMORE) && wcol < MAXCOL)
  #endif
  		    ;
!     line = ml_get_buf(curbuf, pos->lnum, FALSE);
  
      if (wcol >= MAXCOL)
      {
***************
*** 332,340 ****
  #endif
  
  #ifdef FEAT_MBYTE
!     /* prevent cursor from moving on the trail byte */
      if (has_mbyte)
! 	mb_adjust_cursor();
  #endif
  
      if (col < wcol)
--- 332,340 ----
  #endif
  
  #ifdef FEAT_MBYTE
!     /* prevent from moving onto a trail byte */
      if (has_mbyte)
! 	mb_adjustpos(pos);
  #endif
  
      if (col < wcol)
*** ../vim-7.2.278/src/ops.c	2009-09-30 15:15:33.000000000 +0200
--- src/ops.c	2009-11-03 15:18:50.000000000 +0100
***************
*** 2020,2025 ****
--- 2020,2026 ----
  	bd.is_MAX = (curwin->w_curswant == MAXCOL);
  	for ( ; curwin->w_cursor.lnum <= oap->end.lnum; ++curwin->w_cursor.lnum)
  	{
+ 	    curwin->w_cursor.col = 0;  /* make sure cursor position is valid */
  	    block_prep(oap, &bd, curwin->w_cursor.lnum, TRUE);
  	    if (bd.textlen == 0 && (!virtual_op || bd.is_MAX))
  		continue;	    /* nothing to replace */
***************
*** 2035,2040 ****
--- 2036,2042 ----
  	    {
  		pos_T vpos;
  
+ 		vpos.lnum = curwin->w_cursor.lnum;
  		getvpos(&vpos, oap->start_vcol);
  		bd.startspaces += vpos.coladd;
  		n = bd.startspaces;
***************
*** 2693,2703 ****
  			 * initial coladd offset as part of "startspaces" */
  			if (bd.is_short)
  			{
! 			    linenr_T lnum = curwin->w_cursor.lnum;
! 
! 			    curwin->w_cursor.lnum = linenr;
  			    (void)getvpos(&vpos, oap->start_vcol);
- 			    curwin->w_cursor.lnum = lnum;
  			}
  			else
  			    vpos.coladd = 0;
--- 2695,2702 ----
  			 * initial coladd offset as part of "startspaces" */
  			if (bd.is_short)
  			{
! 			    vpos.lnum = linenr;
  			    (void)getvpos(&vpos, oap->start_vcol);
  			}
  			else
  			    vpos.coladd = 0;
*** ../vim-7.2.278/src/version.c	2009-11-03 16:29:48.000000000 +0100
--- src/version.c	2009-11-03 16:41:53.000000000 +0100
***************
*** 678,679 ****
--- 678,681 ----
  {   /* Add new patch number below this line */
+ /**/
+     279,
  /**/

-- 
BEDEVERE: How do you know so much about swallows?
ARTHUR:   Well you have to know these things when you're a king, you know.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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    ///