summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2018-08-17 14:50:21 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2018-08-17 14:50:21 +0000
commit952cac5f4a17e52aec7d0536f405b25428367840 (patch)
treec0b1c85ed4673f6f740028e868e7f639061f9027
parentf7aa8addcd5d7b2a2b50903f1162c272a6f38c0e (diff)
downloadpcre-952cac5f4a17e52aec7d0536f405b25428367840.tar.gz
Fix bad auto-possessify for certain classes.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1738 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--ChangeLog5
-rw-r--r--pcre_compile.c4
-rw-r--r--testdata/testinput43
-rw-r--r--testdata/testoutput44
4 files changed, 14 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 0c06c22..ac42247 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -27,6 +27,11 @@ ported from PCRE2).
4. Typo LCC_ALL for LC_ALL fixed in pcregrep.
+5. In a pattern such as /[^\x{100}-\x{ffff}]*[\x80-\xff]/ which has a repeated
+negative class with no characters less than 0x100 followed by a positive class
+with only characters less than 0x100, the first class was incorrectly being
+auto-possessified, causing incorrect match failures.
+
Version 8.42 20-March-2018
--------------------------
diff --git a/pcre_compile.c b/pcre_compile.c
index 6dd8886..3991d6c 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2016 University of Cambridge
+ Copyright (c) 1997-2018 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -3299,7 +3299,7 @@ for(;;)
if ((*xclass_flags & XCL_MAP) == 0)
{
/* No bits are set for characters < 256. */
- if (list[1] == 0) return TRUE;
+ if (list[1] == 0) return (*xclass_flags & XCL_NOT) == 0;
/* Might be an empty repeat. */
continue;
}
diff --git a/testdata/testinput4 b/testdata/testinput4
index 8bdbdac..63368c0 100644
--- a/testdata/testinput4
+++ b/testdata/testinput4
@@ -727,4 +727,7 @@
/\C(\W?ſ)'?{{/8
\\C(\\W?ſ)'?{{
+/[^\x{100}-\x{ffff}]*[\x80-\xff]/8
+ \x{99}\x{99}\x{99}
+
/-- End of testinput4 --/
diff --git a/testdata/testoutput4 b/testdata/testoutput4
index d43c123..69e812c 100644
--- a/testdata/testoutput4
+++ b/testdata/testoutput4
@@ -1277,4 +1277,8 @@ No match
\\C(\\W?ſ)'?{{
No match
+/[^\x{100}-\x{ffff}]*[\x80-\xff]/8
+ \x{99}\x{99}\x{99}
+ 0: \x{99}\x{99}\x{99}
+
/-- End of testinput4 --/