From 7b67e393f64afd69c48e585d3e4291d7d1b3a0f5 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
Date: Fri, 9 Oct 2015 16:11:18 +0000
Subject: [PATCH] Fix compile bug for classes like [\W\p{Any}].
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1601 2f5784b3-3f2a-0410-8824-cb99058d5e15
Signed-off-by: Petr Písař <ppisar@redhat.com>
Petr Pisar: Ported to 8.37.
---
pcre_compile.c | 5 +++--
testdata/testinput5 | 9 +++++++++
testdata/testoutput5 | 26 ++++++++++++++++++++++++++
4 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/pcre_compile.c b/pcre_compile.c
index 191330a..f8ce576 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -5512,9 +5512,10 @@ for (;; ptr++)
actual compiled code. */
#ifdef SUPPORT_UTF
- if (xclass && (!should_flip_negation || (options & PCRE_UCP) != 0))
+ if (xclass && (xclass_has_prop || !should_flip_negation ||
+ (options & PCRE_UCP) != 0))
#elif !defined COMPILE_PCRE8
- if (xclass && !should_flip_negation)
+ if (xclass && (xclass_has_prop || !should_flip_negation))
#endif
#if defined SUPPORT_UTF || !defined COMPILE_PCRE8
{
diff --git a/testdata/testinput5 b/testdata/testinput5
index 28561a9..c825ca2 100644
--- a/testdata/testinput5
+++ b/testdata/testinput5
@@ -798,4 +798,13 @@
/(?<=\K\x{17f})/8G+
\x{17f}\x{17f}\x{17f}\x{17f}\x{17f}
+/[\W\p{Any}]/BZ
+ abc
+ 123
+
+/[\W\pL]/BZ
+ abc
+ ** Failers
+ 123
+
/-- End of testinput5 --/
diff --git a/testdata/testoutput5 b/testdata/testoutput5
index bab989c..42e5e16 100644
--- a/testdata/testoutput5
+++ b/testdata/testoutput5
@@ -1942,4 +1942,30 @@ Need char = 'z'
0: \x{17f}
0+
+/[\W\p{Any}]/BZ
+------------------------------------------------------------------
+ Bra
+ [\x00-/:-@[-^`{-\xff\p{Any}]
+ Ket
+ End
+------------------------------------------------------------------
+ abc
+ 0: a
+ 123
+ 0: 1
+
+/[\W\pL]/BZ
+------------------------------------------------------------------
+ Bra
+ [\x00-/:-@[-^`{-\xff\p{L}]
+ Ket
+ End
+------------------------------------------------------------------
+ abc
+ 0: a
+ ** Failers
+ 0: *
+ 123
+No match
+
/-- End of testinput5 --/
--
2.4.3