Blob Blame History Raw
From 952cac5f4a17e52aec7d0536f405b25428367840 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
Date: Fri, 17 Aug 2018 14:50:21 +0000
Subject: [PATCH] Fix bad auto-possessify for certain classes.
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@1738 2f5784b3-3f2a-0410-8824-cb99058d5e15
Petr Písař: Ported to 8.42.
---
 pcre_compile.c       | 4 ++--
 testdata/testinput4  | 3 +++
 testdata/testoutput4 | 4 ++++

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 --/
-- 
2.14.4