summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2007-11-14 11:35:48 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2007-11-14 11:35:48 +0000
commitd678cb6b0f13f4d86102ec37e6ce01ffc3136a2d (patch)
treed31386e5c1c0326134e04aa9e02ba25dd8c740d6
parent215cbb51a382717bf585b7f0196f3a72239a8659 (diff)
downloadpcre-d678cb6b0f13f4d86102ec37e6ce01ffc3136a2d.tar.gz
Fix negative POSIX class bug with Unicode characters.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@265 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--ChangeLog3
-rw-r--r--pcre_compile.c1
-rw-r--r--testdata/testinput442
-rw-r--r--testdata/testoutput214
-rw-r--r--testdata/testoutput469
5 files changed, 122 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 7ae4596..185af43 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,9 @@ Version 7.5 12-Nov-07
2. Negative specials like \S did not work in character classes in UTF-8 mode.
Characters greater than 255 were excluded from the class instead of being
included.
+
+3. The same bug as (2) above applied to negated POSIX classes such as
+ [:^space:].
Version 7.4 21-Sep-07
diff --git a/pcre_compile.c b/pcre_compile.c
index 29a6c3d..cd51b4d 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -2710,6 +2710,7 @@ for (;; ptr++)
if (*ptr == '^')
{
local_negate = TRUE;
+ should_flip_negation = TRUE; /* Note negative special */
ptr++;
}
diff --git a/testdata/testinput4 b/testdata/testinput4
index f9306de..886dbce 100644
--- a/testdata/testinput4
+++ b/testdata/testinput4
@@ -565,4 +565,46 @@
/.[^\S\n]./8g
abc def\x{442}\x{443}xyz\npqr
+/[[:^alnum:]]/8g
+ +\x{2442}
+
+/[[:^alpha:]]/8g
+ +\x{2442}
+
+/[[:^ascii:]]/8g
+ A\x{442}
+
+/[[:^blank:]]/8g
+ A\x{442}
+
+/[[:^cntrl:]]/8g
+ A\x{442}
+
+/[[:^digit:]]/8g
+ A\x{442}
+
+/[[:^graph:]]/8g
+ \x19\x{e01ff}
+
+/[[:^lower:]]/8g
+ A\x{422}
+
+/[[:^print:]]/8g
+ \x{19}\x{e01ff}
+
+/[[:^punct:]]/8g
+ A\x{442}
+
+/[[:^space:]]/8g
+ A\x{442}
+
+/[[:^upper:]]/8g
+ a\x{442}
+
+/[[:^word:]]/8g
+ +\x{2442}
+
+/[[:^xdigit:]]/8g
+ M\x{442}
+
/ End of testinput4 /
diff --git a/testdata/testoutput2 b/testdata/testoutput2
index 4b6302c..26cc5b1 100644
--- a/testdata/testoutput2
+++ b/testdata/testoutput2
@@ -1905,7 +1905,7 @@ No need char
------------------------------------------------------------------
Bra
^
- [\x00-/:-@[-`{-\xff]
+ [\x00-/:-@[-`{-\xff] (neg)
Ket
End
------------------------------------------------------------------
@@ -1931,7 +1931,7 @@ No need char
------------------------------------------------------------------
Bra
^
- [\x00-@[-`{-\xff]
+ [\x00-@[-`{-\xff] (neg)
Ket
End
------------------------------------------------------------------
@@ -1965,7 +1965,7 @@ No need char
------------------------------------------------------------------
Bra
^
- [\x80-\xff]
+ [\x80-\xff] (neg)
Ket
End
------------------------------------------------------------------
@@ -1991,7 +1991,7 @@ No need char
------------------------------------------------------------------
Bra
^
- [\x00-\x08\x0a-\x1f!-\xff]
+ [\x00-\x08\x0a-\x1f!-\xff] (neg)
Ket
End
------------------------------------------------------------------
@@ -2142,7 +2142,7 @@ No need char
------------------------------------------------------------------
Bra
^
- [ -~\x80-\xff]
+ [ -~\x80-\xff] (neg)
Ket
End
------------------------------------------------------------------
@@ -2155,7 +2155,7 @@ No need char
------------------------------------------------------------------
Bra
^
- [\x00-/12:-\xff]
+ [\x00-/12:-\xff] (neg)
Ket
End
------------------------------------------------------------------
@@ -2168,7 +2168,7 @@ No need char
------------------------------------------------------------------
Bra
^
- [\x00-\x08\x0a-\x1f!-\xff]
+ [\x00-\x08\x0a-\x1f!-\xff] (neg)
Ket
End
------------------------------------------------------------------
diff --git a/testdata/testoutput4 b/testdata/testoutput4
index ebb298a..cb8400f 100644
--- a/testdata/testoutput4
+++ b/testdata/testoutput4
@@ -1000,4 +1000,73 @@ No match
abc def\x{442}\x{443}xyz\npqr
0: c d
+/[[:^alnum:]]/8g
+ +\x{2442}
+ 0: +
+ 0: \x{2442}
+
+/[[:^alpha:]]/8g
+ +\x{2442}
+ 0: +
+ 0: \x{2442}
+
+/[[:^ascii:]]/8g
+ A\x{442}
+ 0: \x{442}
+
+/[[:^blank:]]/8g
+ A\x{442}
+ 0: A
+ 0: \x{442}
+
+/[[:^cntrl:]]/8g
+ A\x{442}
+ 0: A
+ 0: \x{442}
+
+/[[:^digit:]]/8g
+ A\x{442}
+ 0: A
+ 0: \x{442}
+
+/[[:^graph:]]/8g
+ \x19\x{e01ff}
+ 0: \x{19}
+ 0: \x{e01ff}
+
+/[[:^lower:]]/8g
+ A\x{422}
+ 0: A
+ 0: \x{422}
+
+/[[:^print:]]/8g
+ \x{19}\x{e01ff}
+ 0: \x{19}
+ 0: \x{e01ff}
+
+/[[:^punct:]]/8g
+ A\x{442}
+ 0: A
+ 0: \x{442}
+
+/[[:^space:]]/8g
+ A\x{442}
+ 0: A
+ 0: \x{442}
+
+/[[:^upper:]]/8g
+ a\x{442}
+ 0: a
+ 0: \x{442}
+
+/[[:^word:]]/8g
+ +\x{2442}
+ 0: +
+ 0: \x{2442}
+
+/[[:^xdigit:]]/8g
+ M\x{442}
+ 0: M
+ 0: \x{442}
+
/ End of testinput4 /