Skip to content

Commit

Permalink
Fix bad auto-possessify for certain classes.
Browse files Browse the repository at this point in the history
git-svn-id: svn:https://vcs.exim.org/pcre/code/trunk@1738 2f5784b3-3f2a-0410-8824-cb99058d5e15
  • Loading branch information
ph10 committed Aug 17, 2018
1 parent f7aa8ad commit 952cac5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------------------------
Expand Down
4 changes: 2 additions & 2 deletions pcre_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions testdata/testinput4
Original file line number Diff line number Diff line change
Expand Up @@ -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 --/
4 changes: 4 additions & 0 deletions testdata/testoutput4
Original file line number Diff line number Diff line change
Expand Up @@ -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 --/

0 comments on commit 952cac5

Please sign in to comment.