1
0
forked from aniani/vim

updated for version 7.3.975

Problem:    Crash in regexp parsing.
Solution:   Correctly compute the end of allocated memory.
This commit is contained in:
Bram Moolenaar
2013-05-20 13:44:29 +02:00
parent 10f3a79e89
commit bc0ea8f75e
2 changed files with 9 additions and 2 deletions

View File

@@ -231,14 +231,19 @@ nfa_regcomp_start(expr, re_flags)
/* A reasonable estimation for size */ /* A reasonable estimation for size */
nstate_max = (STRLEN(expr) + 1) * NFA_POSTFIX_MULTIPLIER; nstate_max = (STRLEN(expr) + 1) * NFA_POSTFIX_MULTIPLIER;
/* Size for postfix representation of expr */ /* Some items blow up in size, such as [A-z]. Add more space for that.
* TODO: some patterns may still fail. */
// nstate_max += 1000;
/* Size for postfix representation of expr. */
postfix_size = sizeof(*post_start) * nstate_max; postfix_size = sizeof(*post_start) * nstate_max;
post_start = (int *)lalloc(postfix_size, TRUE); post_start = (int *)lalloc(postfix_size, TRUE);
if (post_start == NULL) if (post_start == NULL)
return FAIL; return FAIL;
vim_memset(post_start, 0, postfix_size); vim_memset(post_start, 0, postfix_size);
post_ptr = post_start; post_ptr = post_start;
post_end = post_start + postfix_size; post_end = post_start + nstate_max;
nfa_has_zend = FALSE; nfa_has_zend = FALSE;
regcomp_start(expr, re_flags); regcomp_start(expr, re_flags);

View File

@@ -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 */
/**/
975,
/**/ /**/
974, 974,
/**/ /**/