mirror of
https://github.com/neovim/neovim.git
synced 2025-10-01 23:48:32 +00:00
vim-patch:8.0.1470: integer overflow when using regexp pattern
Problem: Integer overflow when using regexp pattern. (geeknik)
Solution: Use a long instead of int. (Christian Brabandt, closes vim/vim#2251)
2c7b906afb
This commit is contained in:
@@ -1485,7 +1485,7 @@ static int nfa_regatom(void)
|
||||
|
||||
default:
|
||||
{
|
||||
int n = 0;
|
||||
long n = 0;
|
||||
int cmp = c;
|
||||
|
||||
if (c == '<' || c == '>')
|
||||
@@ -1511,7 +1511,13 @@ static int nfa_regatom(void)
|
||||
EMIT(cmp == '<' ? NFA_VCOL_LT :
|
||||
cmp == '>' ? NFA_VCOL_GT : NFA_VCOL);
|
||||
}
|
||||
EMIT(n);
|
||||
#if SIZEOF_INT < SIZEOF_LONG
|
||||
if (n > INT_MAX) {
|
||||
EMSG(_("E951: \\% value too large"));
|
||||
return FAIL;
|
||||
}
|
||||
#endif
|
||||
EMIT((int)n);
|
||||
break;
|
||||
} else if (c == '\'' && n == 0) {
|
||||
/* \%'m \%<'m \%>'m */
|
||||
|
Reference in New Issue
Block a user