diff options
author | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2010-10-13 10:15:41 +0000 |
---|---|---|
committer | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2010-10-13 10:15:41 +0000 |
commit | e998b8d9a8d15c20e782ae677bc66e4d84294086 (patch) | |
tree | 08cc929852f7e56bb790d9f68a673fc93286c71c | |
parent | e5f5a0846fd1a4c912d3aa6c505a0bde13c40944 (diff) | |
download | pcre-e998b8d9a8d15c20e782ae677bc66e4d84294086.tar.gz |
Fix \s bug in character classes (always removing VT).
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@552 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | pcre_compile.c | 9 | ||||
-rw-r--r-- | testdata/testinput1 | 3 | ||||
-rw-r--r-- | testdata/testoutput1 | 4 |
4 files changed, 19 insertions, 2 deletions
@@ -16,6 +16,11 @@ Version 8.11 10-Oct-2010 result in overall failure. Similarly, (*COMMIT) now overrides (*PRUNE) and (*SKIP), (*SKIP) overrides (*PRUNE) and (*THEN), and (*PRUNE) overrides (*THEN). + +3. If \s appeared in a character class, it removed the VT character from + the class, even if it had been included by some previous item, for example + in [\x00-\xff\s]. (This was a bug related to the fact that VT is not part + of \s, but is part of the POSIX "space" class.) Version 8.10 25-Jun-2010 diff --git a/pcre_compile.c b/pcre_compile.c index 9ad335f..9aa9246 100644 --- a/pcre_compile.c +++ b/pcre_compile.c @@ -3503,9 +3503,14 @@ for (;; ptr++) for (c = 0; c < 32; c++) classbits[c] |= ~cbits[c+cbit_word]; continue; + /* Perl 5.004 onwards omits VT from \s, but we must preserve it + if it was previously set by something earlier in the character + class. */ + case ESC_s: - for (c = 0; c < 32; c++) classbits[c] |= cbits[c+cbit_space]; - classbits[1] &= ~0x08; /* Perl 5.004 onwards omits VT from \s */ + classbits[0] |= cbits[cbit_space]; + classbits[1] |= cbits[cbit_space+1] & ~0x08; + for (c = 2; c < 32; c++) classbits[c] |= cbits[c+cbit_space]; continue; case ESC_S: diff --git a/testdata/testinput1 b/testdata/testinput1 index d999d29..a55cc73 100644 --- a/testdata/testinput1 +++ b/testdata/testinput1 @@ -4073,4 +4073,7 @@ ** Failers XABX +/[\x00-\xff\s]+/ + \x0a\x0b\x0c\x0d + /-- End of testinput1 --/ diff --git a/testdata/testoutput1 b/testdata/testoutput1 index 2fd033c..6f96558 100644 --- a/testdata/testoutput1 +++ b/testdata/testoutput1 @@ -6658,4 +6658,8 @@ No match XABX No match +/[\x00-\xff\s]+/ + \x0a\x0b\x0c\x0d + 0: \x0a\x0b\x0c\x0d + /-- End of testinput1 --/ |