summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--pcre_compile.c8
-rw-r--r--testdata/testinput22
-rw-r--r--testdata/testoutput214
4 files changed, 25 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index beac8ef..405f156 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,7 +11,11 @@ Version 8.39 xx-xxxxxx-201x
an item and its qualifier (for example, A(?#comment)?B) pcre_compile()
misbehaved. This bug was found by the LLVM fuzzer.
-2. Further to 8.38/46, negated classes such as [^[:^ascii:]\d] were also not
+2. Similar to the above, if an isolated \E was present between an item and its
+ qualifier when PCRE_AUTO_CALLOUT was set, pcre_compile() misbehaved. This
+ bug was found by the LLVM fuzzer.
+
+3. Further to 8.38/46, negated classes such as [^[:^ascii:]\d] were also not
working correctly in UCP mode.
diff --git a/pcre_compile.c b/pcre_compile.c
index 3670f1e..5786cd3 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -4645,9 +4645,10 @@ for (;; ptr++)
goto FAILED;
}
- /* If in \Q...\E, check for the end; if not, we have a literal */
+ /* If in \Q...\E, check for the end; if not, we have a literal. Otherwise an
+ isolated \E is ignored. */
- if (inescq && c != CHAR_NULL)
+ if (c != CHAR_NULL)
{
if (c == CHAR_BACKSLASH && ptr[1] == CHAR_E)
{
@@ -4655,7 +4656,7 @@ for (;; ptr++)
ptr++;
continue;
}
- else
+ else if (inescq)
{
if (previous_callout != NULL)
{
@@ -4670,7 +4671,6 @@ for (;; ptr++)
}
goto NORMAL_CHAR;
}
- /* Control does not reach here. */
}
/* In extended mode, skip white space and comments. We need a loop in order
diff --git a/testdata/testinput2 b/testdata/testinput2
index 92e3359..e8ca4fe 100644
--- a/testdata/testinput2
+++ b/testdata/testinput2
@@ -4225,4 +4225,6 @@ backtracking verbs. --/
/L(?#(|++<!(2)?/BCOZ
+/(A*)\E+/CBZ
+
/-- End of testinput2 --/
diff --git a/testdata/testoutput2 b/testdata/testoutput2
index 2cf7a90..09756b8 100644
--- a/testdata/testoutput2
+++ b/testdata/testoutput2
@@ -14610,4 +14610,18 @@ No match
End
------------------------------------------------------------------
+/(A*)\E+/CBZ
+------------------------------------------------------------------
+ Bra
+ Callout 255 0 7
+ SCBra 1
+ Callout 255 1 2
+ A*
+ Callout 255 3 0
+ KetRmax
+ Callout 255 7 0
+ Ket
+ End
+------------------------------------------------------------------
+
/-- End of testinput2 --/