Revision: 1689
http://vcs.pcre.org/viewvc?view=rev&revision=1689
Author: ph10
Date: 2017-03-22 15:17:45 +0000 (Wed, 22 Mar 2017)
Log Message:
-----------
Fix DFA match handling of possessive repeated character class (Bugzilla 2086).
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/pcre_dfa_exec.c
code/trunk/testdata/testinput8
code/trunk/testdata/testoutput8
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2017-02-24 17:30:30 UTC (rev 1688)
+++ code/trunk/ChangeLog 2017-03-22 15:17:45 UTC (rev 1689)
@@ -34,7 +34,10 @@
property for a character with a code point greater than 0x10ffff (the Unicode
maximum) caused a crash.
+8. The alternative matching function, pcre_dfa_exec() misbehaved if it
+encountered a character class with a possessive repeat, for example [a-f]{3}+.
+
Version 8.40 11-January-2017
----------------------------
Modified: code/trunk/pcre_dfa_exec.c
===================================================================
--- code/trunk/pcre_dfa_exec.c 2017-02-24 17:30:30 UTC (rev 1688)
+++ code/trunk/pcre_dfa_exec.c 2017-03-22 15:17:45 UTC (rev 1689)
@@ -7,7 +7,7 @@
below for why this module is different).
Written by Philip Hazel
- Copyright (c) 1997-2014 University of Cambridge
+ Copyright (c) 1997-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -2625,7 +2625,7 @@
if (isinclass)
{
int max = (int)GET2(ecode, 1 + IMM2_SIZE);
- if (*ecode == OP_CRPOSRANGE)
+ if (*ecode == OP_CRPOSRANGE && count >= (int)GET2(ecode, 1))
{
active_count--; /* Remove non-match possibility */
next_active_state--;
Modified: code/trunk/testdata/testinput8
===================================================================
--- code/trunk/testdata/testinput8 2017-02-24 17:30:30 UTC (rev 1688)
+++ code/trunk/testdata/testinput8 2017-03-22 15:17:45 UTC (rev 1689)
@@ -4845,4 +4845,7 @@
aaa\D
a\D
+/(02-)?[0-9]{3}-[0-9]{3}/
+ 02-123-123
+
/-- End of testinput8 --/
Modified: code/trunk/testdata/testoutput8
===================================================================
--- code/trunk/testdata/testoutput8 2017-02-24 17:30:30 UTC (rev 1688)
+++ code/trunk/testdata/testoutput8 2017-03-22 15:17:45 UTC (rev 1689)
@@ -7801,4 +7801,8 @@
** Show all captures ignored after DFA matching
0: a
+/(02-)?[0-9]{3}-[0-9]{3}/
+ 02-123-123
+ 0: 02-123-123
+
/-- End of testinput8 --/