mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.1.0908: can't handle large value for %{nr}v in regexp
Problem: Can't handle large value for %{nr}v in regexp. (Kuang-che Wu)
Solution: Give an error if the value is too large. (closes vim/vim#3948)
9403a2168d
This commit is contained in:
parent
9ea449085d
commit
43f4e5d5be
@ -1503,6 +1503,8 @@ static int nfa_regatom(void)
|
||||
c = getchr();
|
||||
}
|
||||
if (c == 'l' || c == 'c' || c == 'v') {
|
||||
int limit = INT_MAX;
|
||||
|
||||
if (c == 'l') {
|
||||
// \%{n}l \%{n}<l \%{n}>l
|
||||
EMIT(cmp == '<' ? NFA_LNUM_LT :
|
||||
@ -1518,13 +1520,12 @@ static int nfa_regatom(void)
|
||||
// \%{n}v \%{n}<v \%{n}>v
|
||||
EMIT(cmp == '<' ? NFA_VCOL_LT :
|
||||
cmp == '>' ? NFA_VCOL_GT : NFA_VCOL);
|
||||
limit = INT_MAX / MB_MAXBYTES;
|
||||
}
|
||||
#if SIZEOF_INT < SIZEOF_LONG
|
||||
if (n > INT_MAX) {
|
||||
if (n >= limit) {
|
||||
EMSG(_("E951: \\% value too large"));
|
||||
return FAIL;
|
||||
}
|
||||
#endif
|
||||
EMIT((int)n);
|
||||
break;
|
||||
} else if (c == '\'' && n == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user