116 lines
3.4 KiB
Diff
116 lines
3.4 KiB
Diff
r680 | ph10 | 2011-09-06 11:15:54 +0200 (Út, 06 zář 2011) | 2 lines
|
|
|
|
Fix small return value bug.
|
|
|
|
Index: pcre_dfa_exec.c
|
|
===================================================================
|
|
--- pcre_dfa_exec.c (revision 679)
|
|
+++ pcre_dfa_exec.c (revision 680)
|
|
@@ -768,7 +768,7 @@
|
|
current_subject > start_subject + md->start_offset)))
|
|
{
|
|
if (match_count < 0) match_count = (offsetcount >= 2)? 1 : 0;
|
|
- else if (match_count > 0 && ++match_count * 2 >= offsetcount)
|
|
+ else if (match_count > 0 && ++match_count * 2 > offsetcount)
|
|
match_count = 0;
|
|
count = ((match_count == 0)? offsetcount : match_count * 2) - 2;
|
|
if (count > 0) memmove(offsets + 2, offsets, count * sizeof(int));
|
|
|
|
|
|
r681 | ph10 | 2011-09-06 11:16:32 +0200 (Út, 06 zář 2011) | 2 lines
|
|
|
|
Fix loop/bad error when recursed group contains (*PRUNE) etc.
|
|
|
|
When the number of matches in a pcre_dfa_exec() run exactly filled the
|
|
ovector, the return from the function was zero, implying that there were
|
|
other matches that did not fit. The correct "exactly full" value is now
|
|
returned.
|
|
|
|
If a subpattern that was called recursively or as a subroutine contained
|
|
(*PRUNE) or any other control that caused it to give a non-standard return,
|
|
invalid errors such as "Error -26 (nested recursion at the same subject
|
|
position)" or even infinite loops could occur.
|
|
|
|
|
|
Index: pcre_exec.c
|
|
===================================================================
|
|
--- pcre_exec.c (revision 680)
|
|
+++ pcre_exec.c (revision 681)
|
|
@@ -1556,10 +1556,10 @@
|
|
md, eptrb, RM6);
|
|
memcpy(md->offset_vector, new_recursive.offset_save,
|
|
new_recursive.saved_max * sizeof(int));
|
|
+ md->recursive = new_recursive.prevrec;
|
|
if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT)
|
|
{
|
|
DPRINTF(("Recursion matched\n"));
|
|
- md->recursive = new_recursive.prevrec;
|
|
if (new_recursive.offset_save != stacksave)
|
|
(pcre_free)(new_recursive.offset_save);
|
|
|
|
Index: testdata/testoutput11
|
|
===================================================================
|
|
--- testdata/testoutput11 (revision 681)
|
|
+++ testdata/testoutput11 (revision 682)
|
|
@@ -1259,4 +1259,12 @@
|
|
MK: any
|
|
name
|
|
|
|
+/(?>(?&t)c|(?&t))(?(DEFINE)(?<t>a|b(*PRUNE)c))/
|
|
+ a
|
|
+ 0: a
|
|
+ ba
|
|
+ 0: a
|
|
+ bba
|
|
+ 0: a
|
|
+
|
|
/-- End of testinput11 --/
|
|
Index: testdata/testinput7
|
|
===================================================================
|
|
--- testdata/testinput7 (revision 681)
|
|
+++ testdata/testinput7 (revision 682)
|
|
@@ -4699,4 +4699,8 @@
|
|
/(?(R)a*(?1)|((?R))b)/
|
|
aaaabcde
|
|
|
|
+/(a+)/
|
|
+ \O6aaaa
|
|
+ \O8aaaa
|
|
+
|
|
/-- End of testinput7 --/
|
|
Index: testdata/testoutput7
|
|
===================================================================
|
|
--- testdata/testoutput7 (revision 681)
|
|
+++ testdata/testoutput7 (revision 682)
|
|
@@ -7846,4 +7846,16 @@
|
|
aaaabcde
|
|
Error -26 (nested recursion at the same subject position)
|
|
|
|
+/(a+)/
|
|
+ \O6aaaa
|
|
+Matched, but too many subsidiary matches
|
|
+ 0: aaaa
|
|
+ 1: aaa
|
|
+ 2: aa
|
|
+ \O8aaaa
|
|
+ 0: aaaa
|
|
+ 1: aaa
|
|
+ 2: aa
|
|
+ 3: a
|
|
+
|
|
/-- End of testinput7 --/
|
|
Index: testdata/testinput11
|
|
===================================================================
|
|
--- testdata/testinput11 (revision 681)
|
|
+++ testdata/testinput11 (revision 682)
|
|
@@ -670,4 +670,9 @@
|
|
name)/K
|
|
abc
|
|
|
|
+/(?>(?&t)c|(?&t))(?(DEFINE)(?<t>a|b(*PRUNE)c))/
|
|
+ a
|
|
+ ba
|
|
+ bba
|
|
+
|
|
/-- End of testinput11 --/
|