forked from aniani/vim
patch 8.1.0913: CI crashes when running out of memory
Problem: CI crashes when running out of memory. Solution: Apply 'maxmempattern' also to new regexp engine.
This commit is contained in:
@@ -4445,13 +4445,20 @@ skip_add:
|
|||||||
goto skip_add;
|
goto skip_add;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* When there are backreferences or PIMs the number of states may
|
// When there are backreferences or PIMs the number of states may
|
||||||
* be (a lot) bigger than anticipated. */
|
// be (a lot) bigger than anticipated.
|
||||||
if (l->n == l->len)
|
if (l->n == l->len)
|
||||||
{
|
{
|
||||||
int newlen = l->len * 3 / 2 + 50;
|
int newlen = l->len * 3 / 2 + 50;
|
||||||
|
size_t newsize = newlen * sizeof(nfa_thread_T);
|
||||||
nfa_thread_T *newt;
|
nfa_thread_T *newt;
|
||||||
|
|
||||||
|
if ((long)(newsize >> 10) >= p_mmp)
|
||||||
|
{
|
||||||
|
emsg(_(e_maxmempat));
|
||||||
|
--depth;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
if (subs != &temp_subs)
|
if (subs != &temp_subs)
|
||||||
{
|
{
|
||||||
/* "subs" may point into the current array, need to make a
|
/* "subs" may point into the current array, need to make a
|
||||||
@@ -4464,7 +4471,7 @@ skip_add:
|
|||||||
subs = &temp_subs;
|
subs = &temp_subs;
|
||||||
}
|
}
|
||||||
|
|
||||||
newt = vim_realloc(l->t, newlen * sizeof(nfa_thread_T));
|
newt = vim_realloc(l->t, newsize);
|
||||||
if (newt == NULL)
|
if (newt == NULL)
|
||||||
{
|
{
|
||||||
// out of memory
|
// out of memory
|
||||||
@@ -4785,9 +4792,15 @@ addstate_here(
|
|||||||
/* not enough space to move the new states, reallocate the list
|
/* not enough space to move the new states, reallocate the list
|
||||||
* and move the states to the right position */
|
* and move the states to the right position */
|
||||||
int newlen = l->len * 3 / 2 + 50;
|
int newlen = l->len * 3 / 2 + 50;
|
||||||
|
size_t newsize = newlen * sizeof(nfa_thread_T);
|
||||||
nfa_thread_T *newl;
|
nfa_thread_T *newl;
|
||||||
|
|
||||||
newl = (nfa_thread_T *)alloc(newlen * sizeof(nfa_thread_T));
|
if ((long)(newsize >> 10) >= p_mmp)
|
||||||
|
{
|
||||||
|
emsg(_(e_maxmempat));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
newl = (nfa_thread_T *)alloc(newsize);
|
||||||
if (newl == NULL)
|
if (newl == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
l->len = newlen;
|
l->len = newlen;
|
||||||
|
@@ -783,6 +783,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 */
|
||||||
|
/**/
|
||||||
|
913,
|
||||||
/**/
|
/**/
|
||||||
912,
|
912,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user