summaryrefslogtreecommitdiffstats
path: root/source/ap/vim/patches/7.3.521
blob: efe7122b9494fcde57c04626b5f31049b8863a3a (about) (plain) (blame)
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
121
122
123
124
125
126
127
128
129
To: vim_dev@googlegroups.com
Subject: Patch 7.3.521
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.521
Problem:    Using "z=" on a multi-byte character may cause a crash.
Solution:   Don't use strlen() on an int pointer.
Files:	    src/spell.c


*** ../vim-7.3.520/src/spell.c	2012-01-10 22:26:12.000000000 +0100
--- src/spell.c	2012-05-18 18:01:58.000000000 +0200
***************
*** 14494,14506 ****
      int		p0 = -333;
      int		c0;
      int		did_white = FALSE;
  
      /*
       * Convert the multi-byte string to a wide-character string.
       * Remove accents, if wanted.  We actually remove all non-word characters.
       * But keep white space.
       */
!     n = 0;
      for (s = inword; *s != NUL; )
      {
  	t = s;
--- 14494,14508 ----
      int		p0 = -333;
      int		c0;
      int		did_white = FALSE;
+     int		wordlen;
+ 
  
      /*
       * Convert the multi-byte string to a wide-character string.
       * Remove accents, if wanted.  We actually remove all non-word characters.
       * But keep white space.
       */
!     wordlen = 0;
      for (s = inword; *s != NUL; )
      {
  	t = s;
***************
*** 14521,14532 ****
  		    continue;
  	    }
  	}
! 	word[n++] = c;
      }
!     word[n] = NUL;
  
      /*
!      * This comes from Aspell phonet.cpp.
       * Converted from C++ to C.  Added support for multi-byte chars.
       * Changed to keep spaces.
       */
--- 14523,14534 ----
  		    continue;
  	    }
  	}
! 	word[wordlen++] = c;
      }
!     word[wordlen] = NUL;
  
      /*
!      * This algorithm comes from Aspell phonet.cpp.
       * Converted from C++ to C.  Added support for multi-byte chars.
       * Changed to keep spaces.
       */
***************
*** 14711,14717 ****
  			    }
  			if (k > k0)
  			    mch_memmove(word + i + k0, word + i + k,
! 				    sizeof(int) * (STRLEN(word + i + k) + 1));
  
  			/* new "actual letter" */
  			c = word[i];
--- 14713,14719 ----
  			    }
  			if (k > k0)
  			    mch_memmove(word + i + k0, word + i + k,
! 				    sizeof(int) * (wordlen - (i + k) + 1));
  
  			/* new "actual letter" */
  			c = word[i];
***************
*** 14739,14745 ****
  			    if (c != NUL)
  				wres[reslen++] = c;
  			    mch_memmove(word, word + i + 1,
! 				    sizeof(int) * (STRLEN(word + i + 1) + 1));
  			    i = 0;
  			    z0 = 1;
  			}
--- 14741,14747 ----
  			    if (c != NUL)
  				wres[reslen++] = c;
  			    mch_memmove(word, word + i + 1,
! 				       sizeof(int) * (wordlen - (i + 1) + 1));
  			    i = 0;
  			    z0 = 1;
  			}
*** ../vim-7.3.520/src/version.c	2012-05-18 17:03:14.000000000 +0200
--- src/version.c	2012-05-18 18:06:29.000000000 +0200
***************
*** 716,717 ****
--- 716,719 ----
  {   /* Add new patch number below this line */
+ /**/
+     521,
  /**/

-- 
OLD WOMAN: King of the WHO?
ARTHUR:    The Britons.
OLD WOMAN: Who are the Britons?
                 "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/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///