summaryrefslogtreecommitdiffstats
path: root/source/ap/vim/patches/7.3.365
blob: 16d5ad1b0a00909a944904eb6cca3a057142fb64 (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
130
131
To: vim_dev@googlegroups.com
Subject: Patch 7.3.365
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.365
Problem:    Crash when using a large Unicode character in a file that has
	    syntax highlighting. (ngollan)
Solution:   Check for going past the end of the utf tables. (Dominique Pelle)
Files:	    src/mbyte.c


*** ../vim-7.3.364/src/mbyte.c	2011-08-10 13:21:30.000000000 +0200
--- src/mbyte.c	2011-12-08 15:09:13.000000000 +0100
***************
*** 2764,2782 ****
      int			tableSize;
  {
      int start, mid, end; /* indices into table */
  
      start = 0;
!     end = tableSize / sizeof(convertStruct);
      while (start < end)
      {
  	/* need to search further */
! 	mid = (end + start) /2;
  	if (table[mid].rangeEnd < a)
  	    start = mid + 1;
  	else
  	    end = mid;
      }
!     if (table[start].rangeStart <= a && a <= table[start].rangeEnd
  	    && (a - table[start].rangeStart) % table[start].step == 0)
  	return (a + table[start].offset);
      else
--- 2764,2785 ----
      int			tableSize;
  {
      int start, mid, end; /* indices into table */
+     int entries = tableSize / sizeof(convertStruct);
  
      start = 0;
!     end = entries;
      while (start < end)
      {
  	/* need to search further */
! 	mid = (end + start) / 2;
  	if (table[mid].rangeEnd < a)
  	    start = mid + 1;
  	else
  	    end = mid;
      }
!     if (start < entries
! 	    && table[start].rangeStart <= a
! 	    && a <= table[start].rangeEnd
  	    && (a - table[start].rangeStart) % table[start].step == 0)
  	return (a + table[start].offset);
      else
***************
*** 2791,2797 ****
  utf_fold(a)
      int		a;
  {
!     return utf_convert(a, foldCase, sizeof(foldCase));
  }
  
  static convertStruct toLower[] =
--- 2794,2800 ----
  utf_fold(a)
      int		a;
  {
!     return utf_convert(a, foldCase, (int)sizeof(foldCase));
  }
  
  static convertStruct toLower[] =
***************
*** 3119,3125 ****
  	return TOUPPER_LOC(a);
  
      /* For any other characters use the above mapping table. */
!     return utf_convert(a, toUpper, sizeof(toUpper));
  }
  
      int
--- 3122,3128 ----
  	return TOUPPER_LOC(a);
  
      /* For any other characters use the above mapping table. */
!     return utf_convert(a, toUpper, (int)sizeof(toUpper));
  }
  
      int
***************
*** 3152,3158 ****
  	return TOLOWER_LOC(a);
  
      /* For any other characters use the above mapping table. */
!     return utf_convert(a, toLower, sizeof(toLower));
  }
  
      int
--- 3155,3161 ----
  	return TOLOWER_LOC(a);
  
      /* For any other characters use the above mapping table. */
!     return utf_convert(a, toLower, (int)sizeof(toLower));
  }
  
      int
*** ../vim-7.3.364/src/version.c	2011-12-01 20:59:16.000000000 +0100
--- src/version.c	2011-12-08 15:07:53.000000000 +0100
***************
*** 716,717 ****
--- 716,719 ----
  {   /* Add new patch number below this line */
+ /**/
+     365,
  /**/

-- 
Hear about the guy who played a blank tape at full blast?
The mime next door went nuts.

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