[Pcre-svn] [577] code/trunk: Diagnose an overall recursion (…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [577] code/trunk: Diagnose an overall recursion (?0) inside a lookbehind as an error.
Revision: 577
          http://www.exim.org/viewvc/pcre2?view=rev&revision=577
Author:   ph10
Date:     2016-10-23 18:05:09 +0100 (Sun, 23 Oct 2016)
Log Message:
-----------
Diagnose an overall recursion (?0) inside a lookbehind as an error.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/src/pcre2_compile.c
    code/trunk/testdata/testinput2
    code/trunk/testdata/testoutput2


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2016-10-23 16:18:15 UTC (rev 576)
+++ code/trunk/ChangeLog    2016-10-23 17:05:09 UTC (rev 577)
@@ -96,7 +96,10 @@
 16. The "offset" modifier in pcre2test was not being ignored (as documented)
 when the POSIX API was in use.


+17. An overall recursion such as (?0) inside a lookbehind assertion was not
+being diagnosed as an error.

+
Version 10.22 29-July-2016
--------------------------


Modified: code/trunk/src/pcre2_compile.c
===================================================================
--- code/trunk/src/pcre2_compile.c    2016-10-23 16:18:15 UTC (rev 576)
+++ code/trunk/src/pcre2_compile.c    2016-10-23 17:05:09 UTC (rev 577)
@@ -8497,12 +8497,13 @@
       *errcodeptr = ERR15;  /* Non-existent subpattern */
       return -1;
       }
-
+    if (group == 0) goto ISNOTFIXED;  /* Local recursion */
     for (gptr = cb->parsed_pattern; *gptr != META_END; gptr++)
       {
       if (META_CODE(*gptr) == META_BIGVALUE) gptr++;
         else if (*gptr == (META_CAPTURE | group)) break;
       }
+     
     gptrend = parsed_skip(gptr, PSKIP_KET);
     if (pptr > gptr && pptr < gptrend) goto ISNOTFIXED;  /* Local recursion */
     for (r = recurses; r != NULL; r = r->prev) if (r->groupptr == gptr) break;


Modified: code/trunk/testdata/testinput2
===================================================================
--- code/trunk/testdata/testinput2    2016-10-23 16:18:15 UTC (rev 576)
+++ code/trunk/testdata/testinput2    2016-10-23 17:05:09 UTC (rev 577)
@@ -4894,4 +4894,6 @@


/(?=.*[A-Z])/I

+/()(?<=(?0))/
+
# End of testinput2

Modified: code/trunk/testdata/testoutput2
===================================================================
--- code/trunk/testdata/testoutput2    2016-10-23 16:18:15 UTC (rev 576)
+++ code/trunk/testdata/testoutput2    2016-10-23 17:05:09 UTC (rev 577)
@@ -15338,6 +15338,9 @@
 May match empty string
 Subject length lower bound = 0


+/()(?<=(?0))/
+Failed: error 125 at offset 2: lookbehind assertion is not fixed length
+
# End of testinput2
Error -63: PCRE2_ERROR_BADDATA (unknown error number)
Error -62: bad serialized data