blob: b63c0080f11740430f1ce56bad9390a8bba873ff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0908
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
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 -- Bram@Moolenaar.net -- 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 ///
|