[Pcre-svn] [1048] code/trunk: Fix non-recognition of anchori…

Inizio della pagina
Delete this message
Autore: Subversion repository
Data:  
To: pcre-svn
Oggetto: [Pcre-svn] [1048] code/trunk: Fix non-recognition of anchoring when preceded by ( *MARK) etc.
Revision: 1048
          http://www.exim.org/viewvc/pcre2?view=rev&revision=1048
Author:   ph10
Date:     2018-11-27 16:00:58 +0000 (Tue, 27 Nov 2018)
Log Message:
-----------
Fix non-recognition of anchoring when preceded by (*MARK) etc.


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    2018-11-27 10:42:59 UTC (rev 1047)
+++ code/trunk/ChangeLog    2018-11-27 16:00:58 UTC (rev 1048)
@@ -85,7 +85,10 @@


21. Improve MAP_JIT flag usage on MacOS. Patch by Rich Siegel.

+22. If a pattern started with (*MARK), (*COMMIT), (*PRUNE), (*SKIP), or (*THEN)
+followed by ^ it was not recognized as anchored.

+
Version 10.32 10-September-2018
-------------------------------


Modified: code/trunk/src/pcre2_compile.c
===================================================================
--- code/trunk/src/pcre2_compile.c    2018-11-27 10:42:59 UTC (rev 1047)
+++ code/trunk/src/pcre2_compile.c    2018-11-27 16:00:58 UTC (rev 1048)
@@ -4615,6 +4615,14 @@
     code += GET(code, 1) + 1 + LINK_SIZE;
     break;


+    case OP_MARK:
+    case OP_COMMIT_ARG:
+    case OP_PRUNE_ARG:
+    case OP_SKIP_ARG:
+    case OP_THEN_ARG:
+    code += code[1] + PRIV(OP_lengths)[*code];
+    break;
+
     default:
     return code;
     }
@@ -7486,7 +7494,7 @@
     cb->had_recurse = TRUE;
     if (firstcuflags == REQ_UNSET) firstcuflags = REQ_NONE;
     zerofirstcu = firstcu;
-    zerofirstcuflags = firstcuflags;   
+    zerofirstcuflags = firstcuflags;
     break;



@@ -8641,7 +8649,7 @@
     case META_LOOKBEHIND:
     case META_LOOKBEHINDNOT:
     case META_NOCAPTURE:
-    case META_SCRIPT_RUN: 
+    case META_SCRIPT_RUN:
     nestlevel++;
     break;


@@ -9054,7 +9062,7 @@

     case META_ATOMIC:
     case META_NOCAPTURE:
-    case META_SCRIPT_RUN: 
+    case META_SCRIPT_RUN:
     pptr++;
     CHECK_GROUP:
     grouplength = get_grouplength(&pptr, TRUE, errcodeptr, lcptr, group,
@@ -9234,7 +9242,7 @@
     case META_QUERY_QUERY:
     case META_RANGE_ESCAPED:
     case META_RANGE_LITERAL:
-    case META_SCRIPT_RUN: 
+    case META_SCRIPT_RUN:
     case META_SKIP:
     case META_THEN:
     break;


Modified: code/trunk/testdata/testinput2
===================================================================
--- code/trunk/testdata/testinput2    2018-11-27 10:42:59 UTC (rev 1047)
+++ code/trunk/testdata/testinput2    2018-11-27 16:00:58 UTC (rev 1048)
@@ -5553,4 +5553,10 @@
 /foobar/g
     the foobar thing foobar again\=copy_matched_subject


+/(*:XX)^abc/I
+
+/(*COMMIT:XX)^abc/I
+
+/(*ACCEPT:XX)^abc/I
+
# End of testinput2

Modified: code/trunk/testdata/testoutput2
===================================================================
--- code/trunk/testdata/testoutput2    2018-11-27 10:42:59 UTC (rev 1047)
+++ code/trunk/testdata/testoutput2    2018-11-27 16:00:58 UTC (rev 1048)
@@ -16875,6 +16875,24 @@
  0: foobar
  0: foobar


+/(*:XX)^abc/I
+Capturing subpattern count = 0
+Compile options: <none>
+Overall options: anchored
+First code unit = 'a'
+Subject length lower bound = 3
+
+/(*COMMIT:XX)^abc/I
+Capturing subpattern count = 0
+Compile options: <none>
+Overall options: anchored
+First code unit = 'a'
+Subject length lower bound = 3
+
+/(*ACCEPT:XX)^abc/I
+Capturing subpattern count = 0
+Subject length lower bound = 0
+
# End of testinput2
Error -70: PCRE2_ERROR_BADDATA (unknown error number)
Error -62: bad serialized data