mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
updated for version 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)
This commit is contained in:
15
src/mbyte.c
15
src/mbyte.c
@@ -2764,19 +2764,22 @@ utf_convert(a, table, tableSize)
|
|||||||
int tableSize;
|
int tableSize;
|
||||||
{
|
{
|
||||||
int start, mid, end; /* indices into table */
|
int start, mid, end; /* indices into table */
|
||||||
|
int entries = tableSize / sizeof(convertStruct);
|
||||||
|
|
||||||
start = 0;
|
start = 0;
|
||||||
end = tableSize / sizeof(convertStruct);
|
end = entries;
|
||||||
while (start < end)
|
while (start < end)
|
||||||
{
|
{
|
||||||
/* need to search further */
|
/* need to search further */
|
||||||
mid = (end + start) /2;
|
mid = (end + start) / 2;
|
||||||
if (table[mid].rangeEnd < a)
|
if (table[mid].rangeEnd < a)
|
||||||
start = mid + 1;
|
start = mid + 1;
|
||||||
else
|
else
|
||||||
end = mid;
|
end = mid;
|
||||||
}
|
}
|
||||||
if (table[start].rangeStart <= a && a <= table[start].rangeEnd
|
if (start < entries
|
||||||
|
&& table[start].rangeStart <= a
|
||||||
|
&& a <= table[start].rangeEnd
|
||||||
&& (a - table[start].rangeStart) % table[start].step == 0)
|
&& (a - table[start].rangeStart) % table[start].step == 0)
|
||||||
return (a + table[start].offset);
|
return (a + table[start].offset);
|
||||||
else
|
else
|
||||||
@@ -2791,7 +2794,7 @@ utf_convert(a, table, tableSize)
|
|||||||
utf_fold(a)
|
utf_fold(a)
|
||||||
int a;
|
int a;
|
||||||
{
|
{
|
||||||
return utf_convert(a, foldCase, sizeof(foldCase));
|
return utf_convert(a, foldCase, (int)sizeof(foldCase));
|
||||||
}
|
}
|
||||||
|
|
||||||
static convertStruct toLower[] =
|
static convertStruct toLower[] =
|
||||||
@@ -3119,7 +3122,7 @@ utf_toupper(a)
|
|||||||
return TOUPPER_LOC(a);
|
return TOUPPER_LOC(a);
|
||||||
|
|
||||||
/* For any other characters use the above mapping table. */
|
/* For any other characters use the above mapping table. */
|
||||||
return utf_convert(a, toUpper, sizeof(toUpper));
|
return utf_convert(a, toUpper, (int)sizeof(toUpper));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -3152,7 +3155,7 @@ utf_tolower(a)
|
|||||||
return TOLOWER_LOC(a);
|
return TOLOWER_LOC(a);
|
||||||
|
|
||||||
/* For any other characters use the above mapping table. */
|
/* For any other characters use the above mapping table. */
|
||||||
return utf_convert(a, toLower, sizeof(toLower));
|
return utf_convert(a, toLower, (int)sizeof(toLower));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@@ -714,6 +714,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
365,
|
||||||
/**/
|
/**/
|
||||||
364,
|
364,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user