[Pcre-svn] [1132] code/trunk: Fix oversights in recent non-a…

Página superior
Eliminar este mensaje
Autor: Subversion repository
Fecha:  
A: pcre-svn
Asunto: [Pcre-svn] [1132] code/trunk: Fix oversights in recent non-atomic assertions patch.
Revision: 1132
          http://www.exim.org/viewvc/pcre2?view=rev&revision=1132
Author:   ph10
Date:     2019-07-15 17:04:13 +0100 (Mon, 15 Jul 2019)
Log Message:
-----------
Fix oversights in recent non-atomic assertions patch. Fixes ClusterFuzz 15837.


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


Modified: code/trunk/src/pcre2_compile.c
===================================================================
--- code/trunk/src/pcre2_compile.c    2019-07-14 16:44:46 UTC (rev 1131)
+++ code/trunk/src/pcre2_compile.c    2019-07-15 16:04:13 UTC (rev 1132)
@@ -4738,6 +4738,7 @@
     case OP_ASSERT_NOT:
     case OP_ASSERTBACK:
     case OP_ASSERTBACK_NOT:
+    case OP_ASSERTBACK_NA: 
     if (!skipassert) return code;
     do code += GET(code, 1); while (*code == OP_ALT);
     code += PRIV(OP_lengths)[*code];
@@ -6428,7 +6429,7 @@


     /* If we've just compiled an assertion, pop the assert depth. */


-    if (bravalue >= OP_ASSERT && bravalue <= OP_ASSERTBACK_NOT)
+    if (bravalue >= OP_ASSERT && bravalue <= OP_ASSERTBACK_NA)
       cb->assert_depth -= 1;


     /* At the end of compiling, code is still pointing to the start of the
@@ -6578,8 +6579,8 @@
     we must only take the reqcu when the group also set a firstcu. Otherwise,
     in that example, 'X' ends up set for both. */


-    else if (bravalue == OP_ASSERT && subreqcuflags >= 0 &&
-             subfirstcuflags >= 0)
+    else if ((bravalue == OP_ASSERT || bravalue == OP_ASSERT_NA) && 
+             subreqcuflags >= 0 && subfirstcuflags >= 0)
       {
       reqcu = subreqcu;
       reqcuflags = subreqcuflags;
@@ -7013,8 +7014,10 @@


       case OP_ASSERT:
       case OP_ASSERT_NOT:
+      case OP_ASSERT_NA: 
       case OP_ASSERTBACK:
       case OP_ASSERTBACK_NOT:
+      case OP_ASSERTBACK_NA: 
       case OP_ONCE:
       case OP_SCRIPT_RUN:
       case OP_BRA:
@@ -8266,7 +8269,7 @@


    /* Positive forward assertion */


-   else if (op == OP_ASSERT)
+   else if (op == OP_ASSERT || op == OP_ASSERT_NA)
      {
      if (!is_anchored(scode, bracket_map, cb, atomcount, TRUE)) return FALSE;
      }
@@ -8404,7 +8407,7 @@


    /* Positive forward assertions */


-   else if (op == OP_ASSERT)
+   else if (op == OP_ASSERT || op == OP_ASSERT_NA)
      {
      if (!is_startline(scode, bracket_map, cb, atomcount, TRUE))
        return FALSE;
@@ -8646,9 +8649,11 @@
      case OP_CBRAPOS:
      case OP_SCBRAPOS:
      case OP_ASSERT:
+     case OP_ASSERT_NA: 
      case OP_ONCE:
      case OP_SCRIPT_RUN:
-     d = find_firstassertedcu(scode, &dflags, inassert + ((op==OP_ASSERT)?1:0));
+     d = find_firstassertedcu(scode, &dflags, inassert + 
+       ((op == OP_ASSERT || op == OP_ASSERT_NA)?1:0));
      if (dflags < 0)
        return 0;
      if (cflags < 0) { c = d; cflags = dflags; }


Modified: code/trunk/testdata/testinput2
===================================================================
--- code/trunk/testdata/testinput2    2019-07-14 16:44:46 UTC (rev 1131)
+++ code/trunk/testdata/testinput2    2019-07-15 16:04:13 UTC (rev 1132)
@@ -5680,6 +5680,14 @@


/(*napla:ab+)/B

+/(*napla:)+/
+
+/(*naplb:)+/
+
+/(*napla:^x|^y)/I
+
+/(*napla:abc|abd)/I
+
# ----

# End of testinput2

Modified: code/trunk/testdata/testoutput2
===================================================================
--- code/trunk/testdata/testoutput2    2019-07-14 16:44:46 UTC (rev 1131)
+++ code/trunk/testdata/testoutput2    2019-07-15 16:04:13 UTC (rev 1132)
@@ -17165,6 +17165,24 @@
         End
 ------------------------------------------------------------------


+/(*napla:)+/
+
+/(*naplb:)+/
+
+/(*napla:^x|^y)/I
+Capture group count = 0
+May match empty string
+Compile options: <none>
+Overall options: anchored
+Starting code units: x y
+Subject length lower bound = 0
+
+/(*napla:abc|abd)/I
+Capture group count = 0
+May match empty string
+First code unit = 'a'
+Subject length lower bound = 1
+
# ----

# End of testinput2