Patch 8.1.0908
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 #3948)
Files: src/regexp_nfa.c
*** ../vim-8.1.0907/src/regexp_nfa.c 2019-02-13 01:18:34.019341671 +0100
--- src/regexp_nfa.c 2019-02-13 18:32:14.907289010 +0100
***************
*** 1550,1555 ****
--- 1550,1557 ----
}
if (c == 'l' || c == 'c' || c == 'v')
{
+ int limit = INT_MAX;
+
if (c == 'l')
{
/* \%{n}l \%{n}<l \%{n}>l */
***************
*** 1563,1578 ****
EMIT(cmp == '<' ? NFA_COL_LT :
cmp == '>' ? NFA_COL_GT : NFA_COL);
else
/* \%{n}v \%{n}<v \%{n}>v */
EMIT(cmp == '<' ? NFA_VCOL_LT :
cmp == '>' ? NFA_VCOL_GT : NFA_VCOL);
! #if VIM_SIZEOF_INT < VIM_SIZEOF_LONG
! if (n > INT_MAX)
{
emsg(_("E951: \\% value too large"));
return FAIL;
}
- #endif
EMIT((int)n);
break;
}
--- 1565,1581 ----
EMIT(cmp == '<' ? NFA_COL_LT :
cmp == '>' ? NFA_COL_GT : NFA_COL);
else
+ {
/* \%{n}v \%{n}<v \%{n}>v */
EMIT(cmp == '<' ? NFA_VCOL_LT :
cmp == '>' ? NFA_VCOL_GT : NFA_VCOL);
! limit = INT_MAX / MB_MAXBYTES;
! }
! if (n >= limit)
{
emsg(_("E951: \\% value too large"));
return FAIL;
}
EMIT((int)n);
break;
}
*** ../vim-8.1.0907/src/version.c 2019-02-13 01:18:34.019341671 +0100
--- src/version.c 2019-02-13 18:33:56.626681408 +0100
***************
*** 785,786 ****
--- 785,788 ----
{ /* Add new patch number below this line */
+ /**/
+ 908,
/**/
--
The problem with political jokes is that they get elected.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.