mirror of
https://github.com/vim/vim.git
synced 2025-11-13 22:54:27 -05:00
updated for version 7.3.1272
Problem: Crash when editing Ruby file. (Aliaksandr Rahalevich) Solution: Reallocate the state list when necessary.
This commit is contained in:
@@ -4227,6 +4227,30 @@ addstate_here(l, state, subs, pim, ip)
|
|||||||
l->t[listidx] = l->t[l->n - 1];
|
l->t[listidx] = l->t[l->n - 1];
|
||||||
}
|
}
|
||||||
else if (count > 1)
|
else if (count > 1)
|
||||||
|
{
|
||||||
|
if (l->n + count - 1 >= l->len)
|
||||||
|
{
|
||||||
|
/* not enough space to move the new states, reallocate the list
|
||||||
|
* and move the states to the right position */
|
||||||
|
nfa_thread_T *newl;
|
||||||
|
|
||||||
|
l->len = l->len * 3 / 2 + 50;
|
||||||
|
newl = (nfa_thread_T *)alloc(l->len * sizeof(nfa_thread_T));
|
||||||
|
if (newl == NULL)
|
||||||
|
return;
|
||||||
|
mch_memmove(&(newl[0]),
|
||||||
|
&(l->t[0]),
|
||||||
|
sizeof(nfa_thread_T) * listidx);
|
||||||
|
mch_memmove(&(newl[listidx]),
|
||||||
|
&(l->t[l->n - count]),
|
||||||
|
sizeof(nfa_thread_T) * count);
|
||||||
|
mch_memmove(&(newl[listidx + count]),
|
||||||
|
&(l->t[listidx + 1]),
|
||||||
|
sizeof(nfa_thread_T) * (l->n - count - listidx - 1));
|
||||||
|
vim_free(l->t);
|
||||||
|
l->t = newl;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
/* make space for new states, then move them from the
|
/* make space for new states, then move them from the
|
||||||
* end to the current position */
|
* end to the current position */
|
||||||
@@ -4237,6 +4261,7 @@ addstate_here(l, state, subs, pim, ip)
|
|||||||
&(l->t[l->n - 1]),
|
&(l->t[l->n - 1]),
|
||||||
sizeof(nfa_thread_T) * count);
|
sizeof(nfa_thread_T) * count);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
--l->n;
|
--l->n;
|
||||||
*ip = listidx - 1;
|
*ip = listidx - 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -728,6 +728,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 */
|
||||||
|
/**/
|
||||||
|
1272,
|
||||||
/**/
|
/**/
|
||||||
1271,
|
1271,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user