Blame ChangeLog

Packit Service 02e2fd
Change Log for PCRE2
Packit Service 02e2fd
--------------------
Packit Service 02e2fd
Packit Service 02e2fd
Packit Service 02e2fd
Version 10.32-RC1 10-September-2018
Packit Service 02e2fd
-----------------------------------
Packit Service 02e2fd
Packit Service 02e2fd
1. When matching using the the REG_STARTEND feature of the POSIX API with a
Packit Service 02e2fd
non-zero starting offset, unset capturing groups with lower numbers than a
Packit Service 02e2fd
group that did capture something were not being correctly returned as "unset"
Packit Service 02e2fd
(that is, with offset values of -1).
Packit Service 02e2fd
Packit Service 02e2fd
2. When matching using the POSIX API, pcre2test used to omit listing unset
Packit Service 02e2fd
groups altogether. Now it shows those that come before any actual captures as
Packit Service 02e2fd
"<unset>", as happens for non-POSIX matching.
Packit Service 02e2fd
Packit Service 02e2fd
3. Running "pcre2test -C" always stated "\R matches CR, LF, or CRLF only",
Packit Service 02e2fd
whatever the build configuration was. It now correctly says "\R matches all
Packit Service 02e2fd
Unicode newlines" in the default case when --enable-bsr-anycrlf has not been
Packit Service 02e2fd
specified. Similarly, running "pcre2test -C bsr" never produced the result
Packit Service 02e2fd
ANY.
Packit Service 02e2fd
Packit Service 02e2fd
4. Matching the pattern /(*UTF)\C[^\v]+\x80/ against an 8-bit string containing
Packit Service 02e2fd
multi-code-unit characters caused bad behaviour and possibly a crash. This
Packit Service 02e2fd
issue was fixed for other kinds of repeat in release 10.20 by change 19, but
Packit Service 02e2fd
repeating character classes were overlooked.
Packit Service 02e2fd
Packit Service 02e2fd
5. pcre2grep now supports the inclusion of binary zeros in patterns that are
Packit Service 02e2fd
read from files via the -f option.
Packit Service 02e2fd
Packit Service 02e2fd
6. A small fix to pcre2grep to avoid compiler warnings for -Wformat-overflow=2.
Packit Service 02e2fd
Packit Service 02e2fd
7. Added --enable-jit=auto support to configure.ac.
Packit Service 02e2fd
Packit Service 02e2fd
8. Added some dummy variables to the heapframe structure in 16-bit and 32-bit
Packit Service 02e2fd
modes for the benefit of m68k, where pointers can be 16-bit aligned. The
Packit Service 02e2fd
dummies force 32-bit alignment and this ensures that the structure is a
Packit Service 02e2fd
multiple of PCRE2_SIZE, a requirement that is tested at compile time. In other
Packit Service 02e2fd
architectures, alignment requirements take care of this automatically.
Packit Service 02e2fd
Packit Service 02e2fd
9. When returning an error from pcre2_pattern_convert(), ensure the error
Packit Service 02e2fd
offset is set zero for early errors.
Packit Service 02e2fd
Packit Service 02e2fd
10. A number of patches for Windows support from Daniel Richard G:
Packit Service 02e2fd
Packit Service 02e2fd
  (a) List of error numbers in Runtest.bat corrected (it was not the same as in
Packit Service 02e2fd
      Runtest).
Packit Service 02e2fd
Packit Service 02e2fd
  (b) pcre2grep snprintf() workaround as used elsewhere in the tree.
Packit Service 02e2fd
Packit Service 02e2fd
  (c) Support for non-C99 snprintf() that returns -1 in the overflow case.
Packit Service 02e2fd
Packit Service 02e2fd
11. Minor tidy of pcre2_dfa_match() code.
Packit Service 02e2fd
Packit Service 02e2fd
12. Refactored pcre2_dfa_match() so that the internal recursive calls no longer
Packit Service 02e2fd
use the stack for local workspace and local ovectors. Instead, an initial block
Packit Service 02e2fd
of stack is reserved, but if this is insufficient, heap memory is used. The
Packit Service 02e2fd
heap limit parameter now applies to pcre2_dfa_match().
Packit Service 02e2fd
Packit Service 02e2fd
13. If a "find limits" test of DFA matching in pcre2test resulted in too many
Packit Service 02e2fd
matches for the ovector, no matches were displayed.
Packit Service 02e2fd
Packit Service 02e2fd
14. Removed an occurrence of ctrl/Z from test 6 because Windows treats it as
Packit Service 02e2fd
EOF. The test looks to have come from a fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
15. If PCRE2 was built with a default match limit a lot greater than the
Packit Service 02e2fd
default default of 10 000 000, some JIT tests of the match limit no longer
Packit Service 02e2fd
failed. All such tests now set 10 000 000 as the upper limit.
Packit Service 02e2fd
Packit Service 02e2fd
16. Another Windows related patch for pcregrep to ensure that WIN32 is
Packit Service 02e2fd
undefined under Cygwin.
Packit Service 02e2fd
Packit Service 02e2fd
17. Test for the presence of stdint.h and inttypes.h in configure and CMake and
Packit Service 02e2fd
include whichever exists (stdint preferred) instead of unconditionally
Packit Service 02e2fd
including stdint. This makes life easier for old and non-standard systems.
Packit Service 02e2fd
Packit Service 02e2fd
18. Further changes to improve portability, especially to old and or non-
Packit Service 02e2fd
standard systems:
Packit Service 02e2fd
Packit Service 02e2fd
  (a) Put all printf arguments in RunGrepTest into single, not double, quotes,
Packit Service 02e2fd
      and use \0 not \x00 for binary zero.
Packit Service 02e2fd
Packit Service 02e2fd
  (b) Avoid the use of C++ (i.e. BCPL) // comments.
Packit Service 02e2fd
Packit Service 02e2fd
  (c) Parameterize the use of %zu in pcre2test to make it like %td. For both of
Packit Service 02e2fd
      these now, if using MSVC or a standard C before C99, %lu is used with a
Packit Service 02e2fd
      cast if necessary.
Packit Service 02e2fd
Packit Service 02e2fd
19. Applied a contributed patch to CMakeLists.txt to increase the stack size
Packit Service 02e2fd
when linking pcre2test with MSVC. This gets rid of a stack overflow error in
Packit Service 02e2fd
the standard set of tests.
Packit Service 02e2fd
Packit Service 02e2fd
20. Output a warning in pcre2test when ignoring the "altglobal" modifier when
Packit Service 02e2fd
it is given with the "replace" modifier.
Packit Service 02e2fd
Packit Service 02e2fd
21. In both pcre2test and pcre2_substitute(), with global matching, a pattern
Packit Service 02e2fd
that matched an empty string, but never at the starting match offset, was not
Packit Service 02e2fd
handled in a Perl-compatible way. The pattern /(
Packit Service 02e2fd
a pattern. Because \G is in a lookbehind assertion, there has to be a
Packit Service 02e2fd
"bumpalong" before there can be a match. The automatic "advance by one
Packit Service 02e2fd
character after an empty string match" rule is therefore inappropriate. A more
Packit Service 02e2fd
complicated algorithm has now been implemented.
Packit Service 02e2fd
Packit Service 02e2fd
22. When checking to see if a lookbehind is of fixed length, lookaheads were
Packit Service 02e2fd
correctly ignored, but qualifiers on lookaheads were not being ignored, leading
Packit Service 02e2fd
to an incorrect "lookbehind assertion is not fixed length" error.
Packit Service 02e2fd
Packit Service 02e2fd
23. The VERSION condition test was reading fractional PCRE2 version numbers
Packit Service 02e2fd
such as the 04 in 10.04 incorrectly and hence giving wrong results.
Packit Service 02e2fd
Packit Service 02e2fd
24. Updated to Unicode version 11.0.0. As well as the usual addition of new
Packit Service 02e2fd
scripts and characters, this involved re-jigging the grapheme break property
Packit Service 02e2fd
algorithm because Unicode has changed the way emojis are handled.
Packit Service 02e2fd
Packit Service 02e2fd
25. Fixed an obscure bug that struck when there were two atomic groups not
Packit Service 02e2fd
separated by something with a backtracking point. There could be an incorrect
Packit Service 02e2fd
backtrack into the first of the atomic groups. A complicated example is
Packit Service 02e2fd
/(?>a(*:1))(?>b)(*SKIP:1)x|.*/ matched against "abc", where the *SKIP
Packit Service 02e2fd
shouldn't find a MARK (because is in an atomic group), but it did.
Packit Service 02e2fd
Packit Service 02e2fd
26. Upgraded the perltest.sh script: (1) #pattern lines can now be used to set
Packit Service 02e2fd
a list of modifiers for all subsequent patterns - only those that the script
Packit Service 02e2fd
recognizes are meaningful; (2) #subject lines can be used to set or unset a
Packit Service 02e2fd
default "mark" modifier; (3) Unsupported #command lines give a warning when
Packit Service 02e2fd
they are ignored; (4) Mark data is output only if the "mark" modifier is
Packit Service 02e2fd
present.
Packit Service 02e2fd
Packit Service 02e2fd
27. (*ACCEPT:ARG), (*FAIL:ARG), and (*COMMIT:ARG) are now supported.
Packit Service 02e2fd
Packit Service 02e2fd
28. A (*MARK) name was not being passed back for positive assertions that were
Packit Service 02e2fd
terminated by (*ACCEPT).
Packit Service 02e2fd
Packit Service 02e2fd
29. Add support for \N{U+dddd}, but only in Unicode mode.
Packit Service 02e2fd
Packit Service 02e2fd
30. Add support for (?^) for unsetting all imnsx options.
Packit Service 02e2fd
Packit Service 02e2fd
31. The PCRE2_EXTENDED (/x) option only ever discarded space characters whose
Packit Service 02e2fd
code point was less than 256 and that were recognized by the lookup table
Packit Service 02e2fd
generated by pcre2_maketables(), which uses isspace() to identify white space.
Packit Service 02e2fd
Now, when Unicode support is compiled, PCRE2_EXTENDED also discards U+0085,
Packit Service 02e2fd
U+200E, U+200F, U+2028, and U+2029, which are additional characters defined by
Packit Service 02e2fd
Unicode as "Pattern White Space". This makes PCRE2 compatible with Perl.
Packit Service 02e2fd
Packit Service 02e2fd
32. In certain circumstances, option settings within patterns were not being
Packit Service 02e2fd
correctly processed. For example, the pattern /((?i)A)(?m)B/ incorrectly
Packit Service 02e2fd
matched "ab". (The (?m) setting lost the fact that (?i) should be reset at the
Packit Service 02e2fd
end of its group during the parse process, but without another setting such as
Packit Service 02e2fd
(?m) the compile phase got it right.) This bug was introduced by the
Packit Service 02e2fd
refactoring in release 10.23.
Packit Service 02e2fd
Packit Service 02e2fd
33. PCRE2 uses bcopy() if available when memmove() is not, and it used just to
Packit Service 02e2fd
define memmove() as function call to bcopy(). This hasn't been tested for a
Packit Service 02e2fd
long time because in pcre2test the result of memmove() was being used, whereas
Packit Service 02e2fd
bcopy() doesn't return a result. This feature is now refactored always to call
Packit Service 02e2fd
an emulation function when there is no memmove(). The emulation makes use of
Packit Service 02e2fd
bcopy() when available.
Packit Service 02e2fd
Packit Service 02e2fd
34. When serializing a pattern, set the memctl, executable_jit, and tables
Packit Service 02e2fd
fields (that is, all the fields that contain pointers) to zeros so that the
Packit Service 02e2fd
result of serializing is always the same. These fields are re-set when the
Packit Service 02e2fd
pattern is deserialized.
Packit Service 02e2fd
Packit Service 02e2fd
35. In a pattern such as /[^\x{100}-\x{ffff}]*[\x80-\xff]/ which has a repeated
Packit Service 02e2fd
negative class with no characters less than 0x100 followed by a positive class
Packit Service 02e2fd
with only characters less than 0x100, the first class was incorrectly being
Packit Service 02e2fd
auto-possessified, causing incorrect match failures.
Packit Service 02e2fd
Packit Service 02e2fd
36. Removed the character type bit ctype_meta, which dates from PCRE1 and is
Packit Service 02e2fd
not used in PCRE2.
Packit Service 02e2fd
Packit Service 02e2fd
37. Tidied up unnecessarily complicated macros used in the escapes table.
Packit Service 02e2fd
Packit Service 02e2fd
38. Since 10.21, the new testoutput8-16-4 file has accidentally been omitted
Packit Service 02e2fd
from distribution tarballs, owing to a typo in Makefile.am which had
Packit Service 02e2fd
testoutput8-16-3 twice. Now fixed.
Packit Service 02e2fd
Packit Service 02e2fd
39. If the only branch in a conditional subpattern was anchored, the whole
Packit Service 02e2fd
subpattern was treated as anchored, when it should not have been, since the
Packit Service 02e2fd
assumed empty second branch cannot be anchored. Demonstrated by test patterns
Packit Service 02e2fd
such as /(?(1)^())b/ or /(?(?=^))b/.
Packit Service 02e2fd
Packit Service 02e2fd
40. A repeated conditional subpattern that could match an empty string was
Packit Service 02e2fd
always assumed to be unanchored. Now it it checked just like any other
Packit Service 02e2fd
repeated conditional subpattern, and can be found to be anchored if the minimum
Packit Service 02e2fd
quantifier is one or more. I can't see much use for a repeated anchored
Packit Service 02e2fd
pattern, but the behaviour is now consistent.
Packit Service 02e2fd
Packit Service 02e2fd
41. Minor addition to pcre2_jit_compile.c to avoid static analyzer complaint
Packit Service 02e2fd
(for an event that could never occur but you had to have external information
Packit Service 02e2fd
to know that).
Packit Service 02e2fd
Packit Service 02e2fd
42. If before the first match in a file that was being searched by pcre2grep
Packit Service 02e2fd
there was a line that was sufficiently long to cause the input buffer to be
Packit Service 02e2fd
expanded, the variable holding the location of the end of the previous match
Packit Service 02e2fd
was being adjusted incorrectly, and could cause an overflow warning from a code
Packit Service 02e2fd
sanitizer. However, as the value is used only to print pending "after" lines
Packit Service 02e2fd
when the next match is reached (and there are no such lines in this case) this
Packit Service 02e2fd
bug could do no damage.
Packit Service 02e2fd
Packit Service 02e2fd
Packit Service 02e2fd
Version 10.31 12-February-2018
Packit Service 02e2fd
------------------------------
Packit Service 02e2fd
Packit Service 02e2fd
1. Fix typo (missing ]) in VMS code in pcre2test.c.
Packit Service 02e2fd
Packit Service 02e2fd
2. Replace the replicated code for matching extended Unicode grapheme sequences
Packit Service 02e2fd
(which got a lot more complicated by change 10.30/49) by a single subroutine
Packit Service 02e2fd
that is called by both pcre2_match() and pcre2_dfa_match().
Packit Service 02e2fd
Packit Service 02e2fd
3. Add idempotent guard to pcre2_internal.h.
Packit Service 02e2fd
Packit Service 02e2fd
4. Add new pcre2_config() options: PCRE2_CONFIG_NEVER_BACKSLASH_C and
Packit Service 02e2fd
PCRE2_CONFIG_COMPILED_WIDTHS.
Packit Service 02e2fd
Packit Service 02e2fd
5. Cut out \C tests in the JIT regression tests when NEVER_BACKSLASH_C is
Packit Service 02e2fd
defined (e.g. by --enable-never-backslash-C).
Packit Service 02e2fd
Packit Service 02e2fd
6. Defined public names for all the pcre2_compile() error numbers, and used
Packit Service 02e2fd
the public names in pcre2_convert.c.
Packit Service 02e2fd
Packit Service 02e2fd
7. Fixed a small memory leak in pcre2test (convert contexts).
Packit Service 02e2fd
Packit Service 02e2fd
8. Added two casts to compile.c and one to match.c to avoid compiler warnings.
Packit Service 02e2fd
Packit Service 02e2fd
9. Added code to pcre2grep when compiled under VMS to set the symbol
Packit Service 02e2fd
PCRE2GREP_RC to the exit status, because VMS does not distinguish between
Packit Service 02e2fd
exit(0) and exit(1).
Packit Service 02e2fd
Packit Service 02e2fd
10. Added the -LM (list modifiers) option to pcre2test. Also made -C complain
Packit Service 02e2fd
about a bad option only if the following argument item does not start with a
Packit Service 02e2fd
hyphen.
Packit Service 02e2fd
Packit Service 02e2fd
11. pcre2grep was truncating components of file names to 128 characters when
Packit Service 02e2fd
processing files with the -r option, and also (some very odd code) truncating
Packit Service 02e2fd
path names to 512 characters. There is now a check on the absolute length of
Packit Service 02e2fd
full path file names, which may be up to 2047 characters long.
Packit Service 02e2fd
Packit Service 02e2fd
12. When an assertion contained (*ACCEPT) it caused all open capturing groups
Packit Service 02e2fd
to be closed (as for a non-assertion ACCEPT), which was wrong and could lead to
Packit Service 02e2fd
misbehaviour for subsequent references to groups that started outside the
Packit Service 02e2fd
assertion. ACCEPT in an assertion now closes only those groups that were
Packit Service 02e2fd
started within that assertion. Fixes oss-fuzz issues 3852 and 3891.
Packit Service 02e2fd
Packit Service 02e2fd
13. Multiline matching in pcre2grep was misbehaving if the pattern matched
Packit Service 02e2fd
within a line, and then matched again at the end of the line and over into
Packit Service 02e2fd
subsequent lines. Behaviour was different with and without colouring, and
Packit Service 02e2fd
sometimes context lines were incorrectly printed and/or line endings were lost.
Packit Service 02e2fd
All these issues should now be fixed.
Packit Service 02e2fd
Packit Service 02e2fd
14. If --line-buffered was specified for pcre2grep when input was from a
Packit Service 02e2fd
compressed file (.gz or .bz2) a segfault occurred. (Line buffering should be
Packit Service 02e2fd
ignored for compressed files.)
Packit Service 02e2fd
Packit Service 02e2fd
15. Although pcre2_jit_match checks whether the pattern is compiled
Packit Service 02e2fd
in a given mode, it was also expected that at least one mode is available.
Packit Service 02e2fd
This is fixed and pcre2_jit_match returns with PCRE2_ERROR_JIT_BADOPTION
Packit Service 02e2fd
when the pattern is not optimized by JIT at all.
Packit Service 02e2fd
Packit Service 02e2fd
16. The line number and related variables such as match counts in pcre2grep
Packit Service 02e2fd
were all int variables, causing overflow when files with more than 2147483647
Packit Service 02e2fd
lines were processed (assuming 32-bit ints). They have all been changed to
Packit Service 02e2fd
unsigned long ints.
Packit Service 02e2fd
Packit Service 02e2fd
17. If a backreference with a minimum repeat count of zero was first in a
Packit Service 02e2fd
pattern, apart from assertions, an incorrect first matching character could be
Packit Service 02e2fd
recorded. For example, for the pattern /(?=(a))\1?b/, "b" was incorrectly set
Packit Service 02e2fd
as the first character of a match.
Packit Service 02e2fd
Packit Service 02e2fd
18. Characters in a leading positive assertion are considered for recording a
Packit Service 02e2fd
first character of a match when the rest of the pattern does not provide one.
Packit Service 02e2fd
However, a character in a non-assertive group within a leading assertion such
Packit Service 02e2fd
as in the pattern /(?=(a))\1?b/ caused this process to fail. This was an
Packit Service 02e2fd
infelicity rather than an outright bug, because it did not affect the result of
Packit Service 02e2fd
a match, just its speed. (In fact, in this case, the starting 'a' was
Packit Service 02e2fd
subsequently picked up in the study.)
Packit Service 02e2fd
Packit Service 02e2fd
19. A minor tidy in pcre2_match(): making all PCRE2_ERROR_ returns use "return"
Packit Service 02e2fd
instead of "RRETURN" saves unwinding the backtracks in these cases (only one
Packit Service 02e2fd
didn't).
Packit Service 02e2fd
Packit Service 02e2fd
20. Allocate a single callout block on the stack at the start of pcre2_match()
Packit Service 02e2fd
and set its never-changing fields once only. Do the same for pcre2_dfa_match().
Packit Service 02e2fd
Packit Service 02e2fd
21. Save the extra compile options (set in the compile context) with the
Packit Service 02e2fd
compiled pattern (they were not previously saved), add PCRE2_INFO_EXTRAOPTIONS
Packit Service 02e2fd
to retrieve them, and update pcre2test to show them.
Packit Service 02e2fd
Packit Service 02e2fd
22. Added PCRE2_CALLOUT_STARTMATCH and PCRE2_CALLOUT_BACKTRACK bits to a new
Packit Service 02e2fd
field callout_flags in callout blocks. The bits are set by pcre2_match(), but
Packit Service 02e2fd
not by JIT or pcre2_dfa_match(). Their settings are shown in pcre2test callouts
Packit Service 02e2fd
if the callout_extra subject modifier is set. These bits are provided to help
Packit Service 02e2fd
with tracking how a backtracking match is proceeding.
Packit Service 02e2fd
Packit Service 02e2fd
23. Updated the pcre2demo.c demonstration program, which was missing the extra
Packit Service 02e2fd
code for -g that handles the case when \K in an assertion causes the match to
Packit Service 02e2fd
end at the original start point. Also arranged for it to detect when \K causes
Packit Service 02e2fd
the end of a match to be before its start.
Packit Service 02e2fd
Packit Service 02e2fd
24. Similar to 23 above, strange things (including loops) could happen in
Packit Service 02e2fd
pcre2grep when \K was used in an assertion when --colour was used or in
Packit Service 02e2fd
multiline mode. The "end at original start point" bug is fixed, and if the end
Packit Service 02e2fd
point is found to be before the start point, they are swapped.
Packit Service 02e2fd
Packit Service 02e2fd
25. When PCRE2_FIRSTLINE without PCRE2_NO_START_OPTIMIZE was used in non-JIT
Packit Service 02e2fd
matching (both pcre2_match() and pcre2_dfa_match()) and the matched string
Packit Service 02e2fd
started with the first code unit of a newline sequence, matching failed because
Packit Service 02e2fd
it was not tried at the newline.
Packit Service 02e2fd
Packit Service 02e2fd
26. Code for giving up a non-partial match after failing to find a starting
Packit Service 02e2fd
code unit anywhere in the subject was missing when searching for one of a
Packit Service 02e2fd
number of code units (the bitmap case) in both pcre2_match() and
Packit Service 02e2fd
pcre2_dfa_match(). This was a missing optimization rather than a bug.
Packit Service 02e2fd
Packit Service 02e2fd
27. Tidied up the ACROSSCHAR macro to be like FORWARDCHAR and BACKCHAR, using a
Packit Service 02e2fd
pointer argument rather than a code unit value. This should not have affected
Packit Service 02e2fd
the generated code.
Packit Service 02e2fd
Packit Service 02e2fd
28. The JIT compiler has been updated.
Packit Service 02e2fd
Packit Service 02e2fd
29. Avoid pointer overflow for unset captures in pcre2_substring_list_get().
Packit Service 02e2fd
This could not actually cause a crash because it was always used in a memcpy()
Packit Service 02e2fd
call with zero length.
Packit Service 02e2fd
Packit Service 02e2fd
30. Some internal structures have a variable-length ovector[] as their last
Packit Service 02e2fd
element. Their actual memory is obtained dynamically, giving an ovector of
Packit Service 02e2fd
appropriate length. However, they are defined in the structure as
Packit Service 02e2fd
ovector[NUMBER], where NUMBER is large so that array bound checkers don't
Packit Service 02e2fd
grumble. The value of NUMBER was 10000, but a fuzzer exceeded 5000 capturing
Packit Service 02e2fd
groups, making the ovector larger than this. The number has been increased to
Packit Service 02e2fd
131072, which allows for the maximum number of captures (65535) plus the
Packit Service 02e2fd
overall match. This fixes oss-fuzz issue 5415.
Packit Service 02e2fd
Packit Service 02e2fd
31. Auto-possessification at the end of a capturing group was dependent on what
Packit Service 02e2fd
follows the group (e.g. /(a+)b/ would auto-possessify the a+) but this caused
Packit Service 02e2fd
incorrect behaviour when the group was called recursively from elsewhere in the
Packit Service 02e2fd
pattern where something different might follow. This bug is an unforseen
Packit Service 02e2fd
consequence of change #1 for 10.30 - the implementation of backtracking into
Packit Service 02e2fd
recursions. Iterators at the ends of capturing groups are no longer considered
Packit Service 02e2fd
for auto-possessification if the pattern contains any recursions. Fixes
Packit Service 02e2fd
Bugzilla #2232.
Packit Service 02e2fd
Packit Service 02e2fd
Packit Service 02e2fd
Version 10.30 14-August-2017
Packit Service 02e2fd
----------------------------
Packit Service 02e2fd
Packit Service 02e2fd
1. The main interpreter, pcre2_match(), has been refactored into a new version
Packit Service 02e2fd
that does not use recursive function calls (and therefore the stack) for
Packit Service 02e2fd
remembering backtracking positions. This makes --disable-stack-for-recursion a
Packit Service 02e2fd
NOOP. The new implementation allows backtracking into recursive group calls in
Packit Service 02e2fd
patterns, making it more compatible with Perl, and also fixes some other
Packit Service 02e2fd
hard-to-do issues such as #1887 in Bugzilla. The code is also cleaner because
Packit Service 02e2fd
the old code had a number of fudges to try to reduce stack usage. It seems to
Packit Service 02e2fd
run no slower than the old code.
Packit Service 02e2fd
Packit Service 02e2fd
A number of bugs in the refactored code were subsequently fixed during testing
Packit Service 02e2fd
before release, but after the code was made available in the repository. These
Packit Service 02e2fd
bugs were never in fully released code, but are noted here for the record.
Packit Service 02e2fd
Packit Service 02e2fd
  (a) If a pattern had fewer capturing parentheses than the ovector supplied in
Packit Service 02e2fd
      the match data block, a memory error (detectable by ASAN) occurred after
Packit Service 02e2fd
      a match, because the external block was being set from non-existent
Packit Service 02e2fd
      internal ovector fields. Fixes oss-fuzz issue 781.
Packit Service 02e2fd
Packit Service 02e2fd
  (b) A pattern with very many capturing parentheses (when the internal frame
Packit Service 02e2fd
      size was greater than the initial frame vector on the stack) caused a
Packit Service 02e2fd
      crash. A vector on the heap is now set up at the start of matching if the
Packit Service 02e2fd
      vector on the stack is not big enough to handle at least 10 frames.
Packit Service 02e2fd
      Fixes oss-fuzz issue 783.
Packit Service 02e2fd
Packit Service 02e2fd
  (c) Handling of (*VERB)s in recursions was wrong in some cases.
Packit Service 02e2fd
Packit Service 02e2fd
  (d) Captures in negative assertions that were used as conditions were not
Packit Service 02e2fd
      happening if the assertion matched via (*ACCEPT).
Packit Service 02e2fd
Packit Service 02e2fd
  (e) Mark values were not being passed out of recursions.
Packit Service 02e2fd
Packit Service 02e2fd
  (f) Refactor some code in do_callout() to avoid picky compiler warnings about
Packit Service 02e2fd
      negative indices. Fixes oss-fuzz issue 1454.
Packit Service 02e2fd
Packit Service 02e2fd
  (g) Similarly refactor the way the variable length ovector is addressed for
Packit Service 02e2fd
      similar reasons. Fixes oss-fuzz issue 1465.
Packit Service 02e2fd
Packit Service 02e2fd
2. Now that pcre2_match() no longer uses recursive function calls (see above),
Packit Service 02e2fd
the "match limit recursion" value seems misnamed. It still exists, and limits
Packit Service 02e2fd
the depth of tree that is searched. To avoid future confusion, it has been
Packit Service 02e2fd
renamed as "depth limit" in all relevant places (--with-depth-limit,
Packit Service 02e2fd
(*LIMIT_DEPTH), pcre2_set_depth_limit(), etc) but the old names are still
Packit Service 02e2fd
available for backwards compatibility.
Packit Service 02e2fd
Packit Service 02e2fd
3. Hardened pcre2test so as to reduce the number of bugs reported by fuzzers:
Packit Service 02e2fd
Packit Service 02e2fd
  (a) Check for malloc failures when getting memory for the ovector (POSIX) or
Packit Service 02e2fd
      the match data block (non-POSIX).
Packit Service 02e2fd
Packit Service 02e2fd
4. In the 32-bit library in non-UTF mode, an attempt to find a Unicode property
Packit Service 02e2fd
for a character with a code point greater than 0x10ffff (the Unicode maximum)
Packit Service 02e2fd
caused a crash.
Packit Service 02e2fd
Packit Service 02e2fd
5. If a lookbehind assertion that contained a back reference to a group
Packit Service 02e2fd
appearing later in the pattern was compiled with the PCRE2_ANCHORED option,
Packit Service 02e2fd
undefined actions (often a segmentation fault) could occur, depending on what
Packit Service 02e2fd
other options were set. An example assertion is (?
Packit Service 02e2fd
reference \1 precedes the group (abc). This fixes oss-fuzz issue 865.
Packit Service 02e2fd
Packit Service 02e2fd
6. Added the PCRE2_INFO_FRAMESIZE item to pcre2_pattern_info() and arranged for
Packit Service 02e2fd
pcre2test to use it to output the frame size when the "framesize" modifier is
Packit Service 02e2fd
given.
Packit Service 02e2fd
Packit Service 02e2fd
7. Reworked the recursive pattern matching in the JIT compiler to follow the
Packit Service 02e2fd
interpreter changes.
Packit Service 02e2fd
Packit Service 02e2fd
8. When the zero_terminate modifier was specified on a pcre2test subject line
Packit Service 02e2fd
for global matching, unpredictable things could happen. For example, in UTF-8
Packit Service 02e2fd
mode, the pattern //g,zero_terminate read random memory when matched against an
Packit Service 02e2fd
empty string with zero_terminate. This was a bug in pcre2test, not the library.
Packit Service 02e2fd
Packit Service 02e2fd
9. Moved some Windows-specific code in pcre2grep (introduced in 10.23/13) out
Packit Service 02e2fd
of the section that is compiled when Unix-style directory scanning is
Packit Service 02e2fd
available, and into a new section that is always compiled for Windows.
Packit Service 02e2fd
Packit Service 02e2fd
10. In pcre2test, explicitly close the file after an error during serialization
Packit Service 02e2fd
or deserialization (the "load" or "save" commands).
Packit Service 02e2fd
Packit Service 02e2fd
11. Fix memory leak in pcre2_serialize_decode() when the input is invalid.
Packit Service 02e2fd
Packit Service 02e2fd
12. Fix potential NULL dereference in pcre2_callout_enumerate() if called with
Packit Service 02e2fd
a NULL pattern pointer when Unicode support is available.
Packit Service 02e2fd
Packit Service 02e2fd
13. When the 32-bit library was being tested by pcre2test, error messages that
Packit Service 02e2fd
were longer than 64 code units could cause a buffer overflow. This was a bug in
Packit Service 02e2fd
pcre2test.
Packit Service 02e2fd
Packit Service 02e2fd
14. The alternative matching function, pcre2_dfa_match() misbehaved if it
Packit Service 02e2fd
encountered a character class with a possessive repeat, for example [a-f]{3}+.
Packit Service 02e2fd
Packit Service 02e2fd
15. The depth (formerly recursion) limit now applies to DFA matching (as
Packit Service 02e2fd
of 10.23/36); pcre2test has been upgraded so that \=find_limits works with DFA
Packit Service 02e2fd
matching to find the minimum value for this limit.
Packit Service 02e2fd
Packit Service 02e2fd
16. Since 10.21, if pcre2_match() was called with a null context, default
Packit Service 02e2fd
memory allocation functions were used instead of whatever was used when the
Packit Service 02e2fd
pattern was compiled.
Packit Service 02e2fd
Packit Service 02e2fd
17. Changes to the pcre2test "memory" modifier on a subject line. These apply
Packit Service 02e2fd
only to pcre2_match():
Packit Service 02e2fd
Packit Service 02e2fd
  (a) Warn if null_context is set on both pattern and subject, because the
Packit Service 02e2fd
      memory details cannot then be shown.
Packit Service 02e2fd
Packit Service 02e2fd
  (b) Remember (up to a certain number of) memory allocations and their
Packit Service 02e2fd
      lengths, and list only the lengths, so as to be system-independent.
Packit Service 02e2fd
      (In practice, the new interpreter never has more than 2 blocks allocated
Packit Service 02e2fd
      simultaneously.)
Packit Service 02e2fd
Packit Service 02e2fd
18. Make pcre2test detect an error return from pcre2_get_error_message(), give
Packit Service 02e2fd
a message, and abandon the run (this would have detected #13 above).
Packit Service 02e2fd
Packit Service 02e2fd
19. Implemented PCRE2_ENDANCHORED.
Packit Service 02e2fd
Packit Service 02e2fd
20. Applied Jason Hood's patches (slightly modified) to pcre2grep, to implement
Packit Service 02e2fd
the --output=text (-O) option and the inbuilt callout echo.
Packit Service 02e2fd
Packit Service 02e2fd
21. Extend auto-anchoring etc. to ignore groups with a zero qualifier and
Packit Service 02e2fd
single-branch conditions with a false condition (e.g. DEFINE) at the start of a
Packit Service 02e2fd
branch. For example, /(?(DEFINE)...)^A/ and /(...){0}^B/ are now flagged as
Packit Service 02e2fd
anchored.
Packit Service 02e2fd
Packit Service 02e2fd
22. Added an explicit limit on the amount of heap used by pcre2_match(), set by
Packit Service 02e2fd
pcre2_set_heap_limit() or (*LIMIT_HEAP=xxx). Upgraded pcre2test to show the
Packit Service 02e2fd
heap limit along with other pattern information, and to find the minimum when
Packit Service 02e2fd
the find_limits modifier is set.
Packit Service 02e2fd
Packit Service 02e2fd
23. Write to the last 8 bytes of the pcre2_real_code structure when a compiled
Packit Service 02e2fd
pattern is set up so as to initialize any padding the compiler might have
Packit Service 02e2fd
included. This avoids valgrind warnings when a compiled pattern is copied, in
Packit Service 02e2fd
particular when it is serialized.
Packit Service 02e2fd
Packit Service 02e2fd
24. Remove a redundant line of code left in accidentally a long time ago.
Packit Service 02e2fd
Packit Service 02e2fd
25. Remove a duplication typo in pcre2_tables.c
Packit Service 02e2fd
Packit Service 02e2fd
26. Correct an incorrect cast in pcre2_valid_utf.c
Packit Service 02e2fd
Packit Service 02e2fd
27. Update pcre2test, remove some unused code in pcre2_match(), and upgrade the
Packit Service 02e2fd
tests to improve coverage.
Packit Service 02e2fd
Packit Service 02e2fd
28. Some fixes/tidies as a result of looking at Coverity Scan output:
Packit Service 02e2fd
Packit Service 02e2fd
    (a) Typo: ">" should be ">=" in opcode check in pcre2_auto_possess.c.
Packit Service 02e2fd
    (b) Added some casts to avoid "suspicious implicit sign extension".
Packit Service 02e2fd
    (c) Resource leaks in pcre2test in rare error cases.
Packit Service 02e2fd
    (d) Avoid warning for never-use case OP_TABLE_LENGTH which is just a fudge
Packit Service 02e2fd
        for checking at compile time that tables are the right size.
Packit Service 02e2fd
    (e) Add missing "fall through" comment.
Packit Service 02e2fd
Packit Service 02e2fd
29. Implemented PCRE2_EXTENDED_MORE and related /xx and (?xx) features.
Packit Service 02e2fd
Packit Service 02e2fd
30. Implement (?n: for PCRE2_NO_AUTO_CAPTURE, because Perl now has this.
Packit Service 02e2fd
Packit Service 02e2fd
31. If more than one of "push", "pushcopy", or "pushtablescopy" were set in
Packit Service 02e2fd
pcre2test, a crash could occur.
Packit Service 02e2fd
Packit Service 02e2fd
32. Make -bigstack in RunTest allocate a 64MiB stack (instead of 16MiB) so
Packit Service 02e2fd
that all the tests can run with clang's sanitizing options.
Packit Service 02e2fd
Packit Service 02e2fd
33. Implement extra compile options in the compile context and add the first
Packit Service 02e2fd
one: PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES.
Packit Service 02e2fd
Packit Service 02e2fd
34. Implement newline type PCRE2_NEWLINE_NUL.
Packit Service 02e2fd
Packit Service 02e2fd
35. A lookbehind assertion that had a zero-length branch caused undefined
Packit Service 02e2fd
behaviour when processed by pcre2_dfa_match(). This is oss-fuzz issue 1859.
Packit Service 02e2fd
Packit Service 02e2fd
36. The match limit value now also applies to pcre2_dfa_match() as there are
Packit Service 02e2fd
patterns that can use up a lot of resources without necessarily recursing very
Packit Service 02e2fd
deeply. (Compare item 10.23/36.) This should fix oss-fuzz #1761.
Packit Service 02e2fd
Packit Service 02e2fd
37. Implement PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL.
Packit Service 02e2fd
Packit Service 02e2fd
38. Fix returned offsets from regexec() when REG_STARTEND is used with a
Packit Service 02e2fd
starting offset greater than zero.
Packit Service 02e2fd
Packit Service 02e2fd
39. Implement REG_PEND (GNU extension) for the POSIX wrapper.
Packit Service 02e2fd
Packit Service 02e2fd
40. Implement the subject_literal modifier in pcre2test, and allow jitstack on
Packit Service 02e2fd
pattern lines.
Packit Service 02e2fd
Packit Service 02e2fd
41. Implement PCRE2_LITERAL and use it to support REG_NOSPEC.
Packit Service 02e2fd
Packit Service 02e2fd
42. Implement PCRE2_EXTRA_MATCH_LINE and PCRE2_EXTRA_MATCH_WORD for the benefit
Packit Service 02e2fd
of pcre2grep.
Packit Service 02e2fd
Packit Service 02e2fd
43. Re-implement pcre2grep's -F, -w, and -x options using PCRE2_LITERAL,
Packit Service 02e2fd
PCRE2_EXTRA_MATCH_WORD, and PCRE2_EXTRA_MATCH_LINE. This fixes two bugs:
Packit Service 02e2fd
Packit Service 02e2fd
    (a) The -F option did not work for fixed strings containing \E.
Packit Service 02e2fd
    (b) The -w option did not work for patterns with multiple branches.
Packit Service 02e2fd
Packit Service 02e2fd
44. Added configuration options for the SELinux compatible execmem allocator in
Packit Service 02e2fd
JIT.
Packit Service 02e2fd
Packit Service 02e2fd
45. Increased the limit for searching for a "must be present" code unit in
Packit Service 02e2fd
subjects from 1000 to 2000 for 8-bit searches, since they use memchr() and are
Packit Service 02e2fd
much faster.
Packit Service 02e2fd
Packit Service 02e2fd
46. Arrange for anchored patterns to record and use "first code unit" data,
Packit Service 02e2fd
because this can give a fast "no match" without searching for a "required code
Packit Service 02e2fd
unit". Previously only non-anchored patterns did this.
Packit Service 02e2fd
Packit Service 02e2fd
47. Upgraded the Unicode tables from Unicode 8.0.0 to Unicode 10.0.0.
Packit Service 02e2fd
Packit Service 02e2fd
48. Add the callout_no_where modifier to pcre2test.
Packit Service 02e2fd
Packit Service 02e2fd
49. Update extended grapheme breaking rules to the latest set that are in
Packit Service 02e2fd
Unicode Standard Annex #29.
Packit Service 02e2fd
Packit Service 02e2fd
50. Added experimental foreign pattern conversion facilities
Packit Service 02e2fd
(pcre2_pattern_convert() and friends).
Packit Service 02e2fd
Packit Service 02e2fd
51. Change the macro FWRITE, used in pcre2grep, to FWRITE_IGNORE because FWRITE
Packit Service 02e2fd
is defined in a system header in cygwin. Also modified some of the #ifdefs in
Packit Service 02e2fd
pcre2grep related to Windows and Cygwin support.
Packit Service 02e2fd
Packit Service 02e2fd
52. Change 3(g) for 10.23 was a bit too zealous. If a hyphen that follows a
Packit Service 02e2fd
character class is the last character in the class, Perl does not give a
Packit Service 02e2fd
warning. PCRE2 now also treats this as a literal.
Packit Service 02e2fd
Packit Service 02e2fd
53. Related to 52, though PCRE2 was throwing an error for [[:digit:]-X] it was
Packit Service 02e2fd
not doing so for [\d-X] (and similar escapes), as is documented.
Packit Service 02e2fd
Packit Service 02e2fd
54. Fixed a MIPS issue in the JIT compiler reported by Joshua Kinard.
Packit Service 02e2fd
Packit Service 02e2fd
55. Fixed a "maybe uninitialized" warning for class_uchardata in \p handling in
Packit Service 02e2fd
pcre2_compile() which could never actually trigger (code should have been cut
Packit Service 02e2fd
out when Unicode support is disabled).
Packit Service 02e2fd
Packit Service 02e2fd
Packit Service 02e2fd
Version 10.23 14-February-2017
Packit Service 02e2fd
------------------------------
Packit Service 02e2fd
Packit Service 02e2fd
1. Extended pcre2test with the utf8_input modifier so that it is able to
Packit Service 02e2fd
generate all possible 16-bit and 32-bit code unit values in non-UTF modes.
Packit Service 02e2fd
Packit Service 02e2fd
2. In any wide-character mode (8-bit UTF or any 16-bit or 32-bit mode), without
Packit Service 02e2fd
PCRE2_UCP set, a negative character type such as \D in a positive class should
Packit Service 02e2fd
cause all characters greater than 255 to match, whatever else is in the class.
Packit Service 02e2fd
There was a bug that caused this not to happen if a Unicode property item was
Packit Service 02e2fd
added to such a class, for example [\D\P{Nd}] or [\W\pL].
Packit Service 02e2fd
Packit Service 02e2fd
3. There has been a major re-factoring of the pcre2_compile.c file. Most syntax
Packit Service 02e2fd
checking is now done in the pre-pass that identifies capturing groups. This has
Packit Service 02e2fd
reduced the amount of duplication and made the code tidier. While doing this,
Packit Service 02e2fd
some minor bugs and Perl incompatibilities were fixed, including:
Packit Service 02e2fd
Packit Service 02e2fd
  (a) \Q\E in the middle of a quantifier such as A+\Q\E+ is now ignored instead
Packit Service 02e2fd
      of giving an invalid quantifier error.
Packit Service 02e2fd
Packit Service 02e2fd
  (b) {0} can now be used after a group in a lookbehind assertion; previously
Packit Service 02e2fd
      this caused an "assertion is not fixed length" error.
Packit Service 02e2fd
Packit Service 02e2fd
  (c) Perl always treats (?(DEFINE) as a "define" group, even if a group with
Packit Service 02e2fd
      the name "DEFINE" exists. PCRE2 now does likewise.
Packit Service 02e2fd
Packit Service 02e2fd
  (d) A recursion condition test such as (?(R2)...) must now refer to an
Packit Service 02e2fd
      existing subpattern.
Packit Service 02e2fd
Packit Service 02e2fd
  (e) A conditional recursion test such as (?(R)...) misbehaved if there was a
Packit Service 02e2fd
      group whose name began with "R".
Packit Service 02e2fd
Packit Service 02e2fd
  (f) When testing zero-terminated patterns under valgrind, the terminating
Packit Service 02e2fd
      zero is now marked "no access". This catches bugs that would otherwise
Packit Service 02e2fd
      show up only with non-zero-terminated patterns.
Packit Service 02e2fd
Packit Service 02e2fd
  (g) A hyphen appearing immediately after a POSIX character class (for example
Packit Service 02e2fd
      /[[:ascii:]-z]/) now generates an error. Perl does accept this as a
Packit Service 02e2fd
      literal, but gives a warning, so it seems best to fail it in PCRE.
Packit Service 02e2fd
Packit Service 02e2fd
  (h) An empty \Q\E sequence may appear after a callout that precedes an
Packit Service 02e2fd
      assertion condition (it is, of course, ignored).
Packit Service 02e2fd
Packit Service 02e2fd
One effect of the refactoring is that some error numbers and messages have
Packit Service 02e2fd
changed, and the pattern offset given for compiling errors is not always the
Packit Service 02e2fd
right-most character that has been read. In particular, for a variable-length
Packit Service 02e2fd
lookbehind assertion it now points to the start of the assertion. Another
Packit Service 02e2fd
change is that when a callout appears before a group, the "length of next
Packit Service 02e2fd
pattern item" that is passed now just gives the length of the opening
Packit Service 02e2fd
parenthesis item, not the length of the whole group. A length of zero is now
Packit Service 02e2fd
given only for a callout at the end of the pattern. Automatic callouts are no
Packit Service 02e2fd
longer inserted before and after explicit callouts in the pattern.
Packit Service 02e2fd
Packit Service 02e2fd
A number of bugs in the refactored code were subsequently fixed during testing
Packit Service 02e2fd
before release, but after the code was made available in the repository. Many
Packit Service 02e2fd
of the bugs were discovered by fuzzing testing. Several of them were related to
Packit Service 02e2fd
the change from assuming a zero-terminated pattern (which previously had
Packit Service 02e2fd
required non-zero terminated strings to be copied). These bugs were never in
Packit Service 02e2fd
fully released code, but are noted here for the record.
Packit Service 02e2fd
Packit Service 02e2fd
  (a) An overall recursion such as (?0) inside a lookbehind assertion was not
Packit Service 02e2fd
      being diagnosed as an error.
Packit Service 02e2fd
Packit Service 02e2fd
  (b) In utf mode, the length of a *MARK (or other verb) name was being checked
Packit Service 02e2fd
      in characters instead of code units, which could lead to bad code being
Packit Service 02e2fd
      compiled, leading to unpredictable behaviour.
Packit Service 02e2fd
Packit Service 02e2fd
  (c) In extended /x mode, characters whose code was greater than 255 caused
Packit Service 02e2fd
      a lookup outside one of the global tables. A similar bug existed for wide
Packit Service 02e2fd
      characters in *VERB names.
Packit Service 02e2fd
Packit Service 02e2fd
  (d) The amount of memory needed for a compiled pattern was miscalculated if a
Packit Service 02e2fd
      lookbehind contained more than one toplevel branch and the first branch
Packit Service 02e2fd
      was of length zero.
Packit Service 02e2fd
Packit Service 02e2fd
  (e) In UTF-8 or UTF-16 modes with PCRE2_EXTENDED (/x) set and a non-zero-
Packit Service 02e2fd
      terminated pattern, if a # comment ran on to the end of the pattern, one
Packit Service 02e2fd
      or more code units past the end were being read.
Packit Service 02e2fd
Packit Service 02e2fd
  (f) An unterminated repeat at the end of a non-zero-terminated pattern (e.g.
Packit Service 02e2fd
      "{2,2") could cause reading beyond the pattern.
Packit Service 02e2fd
Packit Service 02e2fd
  (g) When reading a callout string, if the end delimiter was at the end of the
Packit Service 02e2fd
      pattern one further code unit was read.
Packit Service 02e2fd
Packit Service 02e2fd
  (h) An unterminated number after \g' could cause reading beyond the pattern.
Packit Service 02e2fd
Packit Service 02e2fd
  (i) An insufficient memory size was being computed for compiling with
Packit Service 02e2fd
      PCRE2_AUTO_CALLOUT.
Packit Service 02e2fd
Packit Service 02e2fd
  (j) A conditional group with an assertion condition used more memory than was
Packit Service 02e2fd
      allowed for it during parsing, so too many of them could therefore
Packit Service 02e2fd
      overrun a buffer.
Packit Service 02e2fd
Packit Service 02e2fd
  (k) If parsing a pattern exactly filled the buffer, the internal test for
Packit Service 02e2fd
      overrun did not check when the final META_END item was added.
Packit Service 02e2fd
Packit Service 02e2fd
  (l) If a lookbehind contained a subroutine call, and the called group
Packit Service 02e2fd
      contained an option setting such as (?s), and the PCRE2_ANCHORED option
Packit Service 02e2fd
      was set, unpredictable behaviour could occur. The underlying bug was
Packit Service 02e2fd
      incorrect code and insufficient checking while searching for the end of
Packit Service 02e2fd
      the called subroutine in the parsed pattern.
Packit Service 02e2fd
Packit Service 02e2fd
  (m) Quantifiers following (*VERB)s were not being diagnosed as errors.
Packit Service 02e2fd
Packit Service 02e2fd
  (n) The use of \Q...\E in a (*VERB) name when PCRE2_ALT_VERBNAMES and
Packit Service 02e2fd
      PCRE2_AUTO_CALLOUT were both specified caused undetermined behaviour.
Packit Service 02e2fd
Packit Service 02e2fd
  (o) If \Q was preceded by a quantified item, and the following \E was
Packit Service 02e2fd
      followed by '?' or '+', and there was at least one literal character
Packit Service 02e2fd
      between them, an internal error "unexpected repeat" occurred (example:
Packit Service 02e2fd
      /.+\QX\E+/).
Packit Service 02e2fd
Packit Service 02e2fd
  (p) A buffer overflow could occur while sorting the names in the group name
Packit Service 02e2fd
      list (depending on the order in which the names were seen).
Packit Service 02e2fd
Packit Service 02e2fd
  (q) A conditional group that started with a callout was not doing the right
Packit Service 02e2fd
      check for a following assertion, leading to compiling bad code. Example:
Packit Service 02e2fd
      /(?(C'XX))?!XX/
Packit Service 02e2fd
Packit Service 02e2fd
  (r) If a character whose code point was greater than 0xffff appeared within
Packit Service 02e2fd
      a lookbehind that was within another lookbehind, the calculation of the
Packit Service 02e2fd
      lookbehind length went wrong and could provoke an internal error.
Packit Service 02e2fd
Packit Service 02e2fd
  (t) The sequence \E- or \Q\E- after a POSIX class in a character class caused
Packit Service 02e2fd
      an internal error. Now the hyphen is treated as a literal.
Packit Service 02e2fd
Packit Service 02e2fd
4. Back references are now permitted in lookbehind assertions when there are
Packit Service 02e2fd
no duplicated group numbers (that is, (?| has not been used), and, if the
Packit Service 02e2fd
reference is by name, there is only one group of that name. The referenced
Packit Service 02e2fd
group must, of course be of fixed length.
Packit Service 02e2fd
Packit Service 02e2fd
5. pcre2test has been upgraded so that, when run under valgrind with valgrind
Packit Service 02e2fd
support enabled, reading past the end of the pattern is detected, both when
Packit Service 02e2fd
compiling and during callout processing.
Packit Service 02e2fd
Packit Service 02e2fd
6. \g{+<number>} (e.g. \g{+2} ) is now supported. It is a "forward back
Packit Service 02e2fd
reference" and can be useful in repetitions (compare \g{-<number>} ). Perl does
Packit Service 02e2fd
not recognize this syntax.
Packit Service 02e2fd
Packit Service 02e2fd
7. Automatic callouts are no longer generated before and after callouts in the
Packit Service 02e2fd
pattern.
Packit Service 02e2fd
Packit Service 02e2fd
8. When pcre2test was outputing information from a callout, the caret indicator
Packit Service 02e2fd
for the current position in the subject line was incorrect if it was after an
Packit Service 02e2fd
escape sequence for a character whose code point was greater than \x{ff}.
Packit Service 02e2fd
Packit Service 02e2fd
9. Change 19 for 10.22 had a typo (PCRE_STATIC_RUNTIME should be
Packit Service 02e2fd
PCRE2_STATIC_RUNTIME). Fix from David Gaussmann.
Packit Service 02e2fd
Packit Service 02e2fd
10. Added --max-buffer-size to pcre2grep, to allow for automatic buffer
Packit Service 02e2fd
expansion when long lines are encountered. Original patch by Dmitry
Packit Service 02e2fd
Cherniachenko.
Packit Service 02e2fd
Packit Service 02e2fd
11. If pcre2grep was compiled with JIT support, but the library was compiled
Packit Service 02e2fd
without it (something that neither ./configure nor CMake allow, but it can be
Packit Service 02e2fd
done by editing config.h), pcre2grep was giving a JIT error. Now it detects
Packit Service 02e2fd
this situation and does not try to use JIT.
Packit Service 02e2fd
Packit Service 02e2fd
12. Added some "const" qualifiers to variables in pcre2grep.
Packit Service 02e2fd
Packit Service 02e2fd
13. Added Dmitry Cherniachenko's patch for colouring output in Windows
Packit Service 02e2fd
(untested by me). Also, look for GREP_COLOUR or GREP_COLOR if the environment
Packit Service 02e2fd
variables PCRE2GREP_COLOUR and PCRE2GREP_COLOR are not found.
Packit Service 02e2fd
Packit Service 02e2fd
14. Add the -t (grand total) option to pcre2grep.
Packit Service 02e2fd
Packit Service 02e2fd
15. A number of bugs have been mended relating to match start-up optimizations
Packit Service 02e2fd
when the first thing in a pattern is a positive lookahead. These all applied
Packit Service 02e2fd
only when PCRE2_NO_START_OPTIMIZE was *not* set:
Packit Service 02e2fd
Packit Service 02e2fd
    (a) A pattern such as (?=.*X)X$ was incorrectly optimized as if it needed
Packit Service 02e2fd
        both an initial 'X' and a following 'X'.
Packit Service 02e2fd
    (b) Some patterns starting with an assertion that started with .* were
Packit Service 02e2fd
        incorrectly optimized as having to match at the start of the subject or
Packit Service 02e2fd
        after a newline. There are cases where this is not true, for example,
Packit Service 02e2fd
        (?=.*[A-Z])(?=.{8,16})(?!.*[\s]) matches after the start in lines that
Packit Service 02e2fd
        start with spaces. Starting .* in an assertion is no longer taken as an
Packit Service 02e2fd
        indication of matching at the start (or after a newline).
Packit Service 02e2fd
Packit Service 02e2fd
16. The "offset" modifier in pcre2test was not being ignored (as documented)
Packit Service 02e2fd
when the POSIX API was in use.
Packit Service 02e2fd
Packit Service 02e2fd
17. Added --enable-fuzz-support to "configure", causing an non-installed
Packit Service 02e2fd
library containing a test function that can be called by fuzzers to be
Packit Service 02e2fd
compiled. A non-installed  binary to run the test function locally, called
Packit Service 02e2fd
pcre2fuzzcheck is also compiled.
Packit Service 02e2fd
Packit Service 02e2fd
18. A pattern with PCRE2_DOTALL (/s) set but not PCRE2_NO_DOTSTAR_ANCHOR, and
Packit Service 02e2fd
which started with .* inside a positive lookahead was incorrectly being
Packit Service 02e2fd
compiled as implicitly anchored.
Packit Service 02e2fd
Packit Service 02e2fd
19. Removed all instances of "register" declarations, as they are considered
Packit Service 02e2fd
obsolete these days and in any case had become very haphazard.
Packit Service 02e2fd
Packit Service 02e2fd
20. Add strerror() to pcre2test for failed file opening.
Packit Service 02e2fd
Packit Service 02e2fd
21. Make pcre2test -C list valgrind support when it is enabled.
Packit Service 02e2fd
Packit Service 02e2fd
22. Add the use_length modifier to pcre2test.
Packit Service 02e2fd
Packit Service 02e2fd
23. Fix an off-by-one bug in pcre2test for the list of names for 'get' and
Packit Service 02e2fd
'copy' modifiers.
Packit Service 02e2fd
Packit Service 02e2fd
24. Add PCRE2_CALL_CONVENTION into the prototype declarations in pcre2.h as it
Packit Service 02e2fd
is apparently needed there as well as in the function definitions. (Why did
Packit Service 02e2fd
nobody ask for this in PCRE1?)
Packit Service 02e2fd
Packit Service 02e2fd
25. Change the _PCRE2_H and _PCRE2_UCP_H guard macros in the header files to
Packit Service 02e2fd
PCRE2_H_IDEMPOTENT_GUARD and PCRE2_UCP_H_IDEMPOTENT_GUARD to be more standard
Packit Service 02e2fd
compliant and unique.
Packit Service 02e2fd
Packit Service 02e2fd
26. pcre2-config --libs-posix was listing -lpcre2posix instead of
Packit Service 02e2fd
-lpcre2-posix. Also, the CMake build process was building the library with the
Packit Service 02e2fd
wrong name.
Packit Service 02e2fd
Packit Service 02e2fd
27. In pcre2test, give some offset information for errors in hex patterns.
Packit Service 02e2fd
This uses the C99 formatting sequence %td, except for MSVC which doesn't
Packit Service 02e2fd
support it - %lu is used instead.
Packit Service 02e2fd
Packit Service 02e2fd
28. Implemented pcre2_code_copy_with_tables(), and added pushtablescopy to
Packit Service 02e2fd
pcre2test for testing it.
Packit Service 02e2fd
Packit Service 02e2fd
29. Fix small memory leak in pcre2test.
Packit Service 02e2fd
Packit Service 02e2fd
30. Fix out-of-bounds read for partial matching of /./ against an empty string
Packit Service 02e2fd
when the newline type is CRLF.
Packit Service 02e2fd
Packit Service 02e2fd
31. Fix a bug in pcre2test that caused a crash when a locale was set either in
Packit Service 02e2fd
the current pattern or a previous one and a wide character was matched.
Packit Service 02e2fd
Packit Service 02e2fd
32. The appearance of \p, \P, or \X in a substitution string when
Packit Service 02e2fd
PCRE2_SUBSTITUTE_EXTENDED was set caused a segmentation fault (NULL
Packit Service 02e2fd
dereference).
Packit Service 02e2fd
Packit Service 02e2fd
33. If the starting offset was specified as greater than the subject length in
Packit Service 02e2fd
a call to pcre2_substitute() an out-of-bounds memory reference could occur.
Packit Service 02e2fd
Packit Service 02e2fd
34. When PCRE2 was compiled to use the heap instead of the stack for recursive
Packit Service 02e2fd
calls to match(), a repeated minimizing caseless back reference, or a
Packit Service 02e2fd
maximizing one where the two cases had different numbers of code units,
Packit Service 02e2fd
followed by a caseful back reference, could lose the caselessness of the first
Packit Service 02e2fd
repeated back reference (example: /(Z)(a)\2{1,2}?(?-i)\1X/i should match ZaAAZX
Packit Service 02e2fd
but didn't).
Packit Service 02e2fd
Packit Service 02e2fd
35. When a pattern is too complicated, PCRE2 gives up trying to find a minimum
Packit Service 02e2fd
matching length and just records zero. Typically this happens when there are
Packit Service 02e2fd
too many nested or recursive back references. If the limit was reached in
Packit Service 02e2fd
certain recursive cases it failed to be triggered and an internal error could
Packit Service 02e2fd
be the result.
Packit Service 02e2fd
Packit Service 02e2fd
36. The pcre2_dfa_match() function now takes note of the recursion limit for
Packit Service 02e2fd
the internal recursive calls that are used for lookrounds and recursions within
Packit Service 02e2fd
the pattern.
Packit Service 02e2fd
Packit Service 02e2fd
37. More refactoring has got rid of the internal could_be_empty_branch()
Packit Service 02e2fd
function (around 400 lines of code, including comments) by keeping track of
Packit Service 02e2fd
could-be-emptiness as the pattern is compiled instead of scanning compiled
Packit Service 02e2fd
groups. (This would have been much harder before the refactoring of #3 above.)
Packit Service 02e2fd
This lifts a restriction on the number of branches in a group (more than about
Packit Service 02e2fd
1100 would give "pattern is too complicated").
Packit Service 02e2fd
Packit Service 02e2fd
38. Add the "-ac" command line option to pcre2test as a synonym for "-pattern
Packit Service 02e2fd
auto_callout".
Packit Service 02e2fd
Packit Service 02e2fd
39. In a library with Unicode support, incorrect data was compiled for a
Packit Service 02e2fd
pattern with PCRE2_UCP set without PCRE2_UTF if a class required all wide
Packit Service 02e2fd
characters to match (for example, /[\s[:^ascii:]]/).
Packit Service 02e2fd
Packit Service 02e2fd
40. The callout_error modifier has been added to pcre2test to make it possible
Packit Service 02e2fd
to return PCRE2_ERROR_CALLOUT from a callout.
Packit Service 02e2fd
Packit Service 02e2fd
41. A minor change to pcre2grep: colour reset is now "<esc>[0m" instead of
Packit Service 02e2fd
"<esc>[00m".
Packit Service 02e2fd
Packit Service 02e2fd
42. The limit in the auto-possessification code that was intended to catch
Packit Service 02e2fd
overly-complicated patterns and not spend too much time auto-possessifying was
Packit Service 02e2fd
being reset too often, resulting in very long compile times for some patterns.
Packit Service 02e2fd
Now such patterns are no longer completely auto-possessified.
Packit Service 02e2fd
Packit Service 02e2fd
43. Applied Jason Hood's revised patch for RunTest.bat.
Packit Service 02e2fd
Packit Service 02e2fd
44. Added a new Windows script RunGrepTest.bat, courtesy of Jason Hood.
Packit Service 02e2fd
Packit Service 02e2fd
45. Minor cosmetic fix to pcre2test: move a variable that is not used under
Packit Service 02e2fd
Windows into the "not Windows" code.
Packit Service 02e2fd
Packit Service 02e2fd
46. Applied Jason Hood's patches to upgrade pcre2grep under Windows and tidy
Packit Service 02e2fd
some of the code:
Packit Service 02e2fd
Packit Service 02e2fd
  * normalised the Windows condition by ensuring WIN32 is defined;
Packit Service 02e2fd
  * enables the callout feature under Windows;
Packit Service 02e2fd
  * adds globbing (Microsoft's implementation expands quoted args),
Packit Service 02e2fd
    using a tweaked opendirectory;
Packit Service 02e2fd
  * implements the is_*_tty functions for Windows;
Packit Service 02e2fd
  * --color=always will write the ANSI sequences to file;
Packit Service 02e2fd
  * add sequences 4 (underline works on Win10) and 5 (blink as bright
Packit Service 02e2fd
    background, relatively standard on DOS/Win);
Packit Service 02e2fd
  * remove the (char *) casts for the now-const strings;
Packit Service 02e2fd
  * remove GREP_COLOUR (grep's command line allowed the 'u', but not
Packit Service 02e2fd
    the environment), parsing GREP_COLORS instead;
Packit Service 02e2fd
  * uses the current colour if not set, rather than black;
Packit Service 02e2fd
  * add print_match for the undefined case;
Packit Service 02e2fd
  * fixes a typo.
Packit Service 02e2fd
Packit Service 02e2fd
In addition, colour settings containing anything other than digits and
Packit Service 02e2fd
semicolon are ignored, and the colour controls are no longer output for empty
Packit Service 02e2fd
strings.
Packit Service 02e2fd
Packit Service 02e2fd
47. Detecting patterns that are too large inside the length-measuring loop
Packit Service 02e2fd
saves processing ridiculously long patterns to their end.
Packit Service 02e2fd
Packit Service 02e2fd
48. Ignore PCRE2_CASELESS when processing \h, \H, \v, and \V in classes as it
Packit Service 02e2fd
just wastes time. In the UTF case it can also produce redundant entries in
Packit Service 02e2fd
XCLASS lists caused by characters with multiple other cases and pairs of
Packit Service 02e2fd
characters in the same "not-x" sublists.
Packit Service 02e2fd
Packit Service 02e2fd
49. A pattern such as /(?=(a\K))/ can report the end of the match being before
Packit Service 02e2fd
its start; pcre2test was not handling this correctly when using the POSIX
Packit Service 02e2fd
interface (it was OK with the native interface).
Packit Service 02e2fd
Packit Service 02e2fd
50. In pcre2grep, ignore all JIT compile errors. This means that pcre2grep will
Packit Service 02e2fd
continue to work, falling back to interpretation if anything goes wrong with
Packit Service 02e2fd
JIT.
Packit Service 02e2fd
Packit Service 02e2fd
51. Applied patches from Christian Persch to configure.ac to make use of the
Packit Service 02e2fd
AC_USE_SYSTEM_EXTENSIONS macro and to test for functions used by the JIT
Packit Service 02e2fd
modules.
Packit Service 02e2fd
Packit Service 02e2fd
52. Minor fixes to pcre2grep from Jason Hood:
Packit Service 02e2fd
    * fixed some spacing;
Packit Service 02e2fd
    * Windows doesn't usually use single quotes, so I've added a define
Packit Service 02e2fd
      to use appropriate quotes [in an example];
Packit Service 02e2fd
    * LC_ALL was displayed as "LCC_ALL";
Packit Service 02e2fd
    * numbers 11, 12 & 13 should end in "th";
Packit Service 02e2fd
    * use double quotes in usage message.
Packit Service 02e2fd
Packit Service 02e2fd
53. When autopossessifying, skip empty branches without recursion, to reduce
Packit Service 02e2fd
stack usage for the benefit of clang with -fsanitize-address, which uses huge
Packit Service 02e2fd
stack frames. Example pattern: /X?(R||){3335}/. Fixes oss-fuzz issue 553.
Packit Service 02e2fd
Packit Service 02e2fd
54. A pattern with very many explicit back references to a group that is a long
Packit Service 02e2fd
way from the start of the pattern could take a long time to compile because
Packit Service 02e2fd
searching for the referenced group in order to find the minimum length was
Packit Service 02e2fd
being done repeatedly. Now up to 128 group minimum lengths are cached and the
Packit Service 02e2fd
attempt to find a minimum length is abandoned if there is a back reference to a
Packit Service 02e2fd
group whose number is greater than 128. (In that case, the pattern is so
Packit Service 02e2fd
complicated that this optimization probably isn't worth it.) This fixes
Packit Service 02e2fd
oss-fuzz issue 557.
Packit Service 02e2fd
Packit Service 02e2fd
55. Issue 32 for 10.22 below was not correctly fixed. If pcre2grep in multiline
Packit Service 02e2fd
mode with --only-matching matched several lines, it restarted scanning at the
Packit Service 02e2fd
next line instead of moving on to the end of the matched string, which can be
Packit Service 02e2fd
several lines after the start.
Packit Service 02e2fd
Packit Service 02e2fd
56. Applied Jason Hood's new patch for RunGrepTest.bat that updates it in line
Packit Service 02e2fd
with updates to the non-Windows version.
Packit Service 02e2fd
Packit Service 02e2fd
Packit Service 02e2fd
Packit Service 02e2fd
Version 10.22 29-July-2016
Packit Service 02e2fd
--------------------------
Packit Service 02e2fd
Packit Service 02e2fd
1. Applied Jason Hood's patches to RunTest.bat and testdata/wintestoutput3
Packit Service 02e2fd
to fix problems with running the tests under Windows.
Packit Service 02e2fd
Packit Service 02e2fd
2. Implemented a facility for quoting literal characters within hexadecimal
Packit Service 02e2fd
patterns in pcre2test, to make it easier to create patterns with just a few
Packit Service 02e2fd
non-printing characters.
Packit Service 02e2fd
Packit Service 02e2fd
3. Binary zeros are not supported in pcre2test input files. It now detects them
Packit Service 02e2fd
and gives an error.
Packit Service 02e2fd
Packit Service 02e2fd
4. Updated the valgrind parameters in RunTest: (a) changed smc-check=all to
Packit Service 02e2fd
smc-check=all-non-file; (b) changed obj:* in the suppression file to obj:??? so
Packit Service 02e2fd
that it matches only unknown objects.
Packit Service 02e2fd
Packit Service 02e2fd
5. Updated the maintenance script maint/ManyConfigTests to make it easier to
Packit Service 02e2fd
select individual groups of tests.
Packit Service 02e2fd
Packit Service 02e2fd
6. When the POSIX wrapper function regcomp() is called, the REG_NOSUB option
Packit Service 02e2fd
used to set PCRE2_NO_AUTO_CAPTURE when calling pcre2_compile(). However, this
Packit Service 02e2fd
disables the use of back references (and subroutine calls), which are supported
Packit Service 02e2fd
by other implementations of regcomp() with RE_NOSUB. Therefore, REG_NOSUB no
Packit Service 02e2fd
longer causes PCRE2_NO_AUTO_CAPTURE to be set, though it still ignores nmatch
Packit Service 02e2fd
and pmatch when regexec() is called.
Packit Service 02e2fd
Packit Service 02e2fd
7. Because of 6 above, pcre2test has been modified with a new modifier called
Packit Service 02e2fd
posix_nosub, to call regcomp() with REG_NOSUB. Previously the no_auto_capture
Packit Service 02e2fd
modifier had this effect. That option is now ignored when the POSIX API is in
Packit Service 02e2fd
use.
Packit Service 02e2fd
Packit Service 02e2fd
8. Minor tidies to the pcre2demo.c sample program, including more comments
Packit Service 02e2fd
about its 8-bit-ness.
Packit Service 02e2fd
Packit Service 02e2fd
9. Detect unmatched closing parentheses and give the error in the pre-scan
Packit Service 02e2fd
instead of later. Previously the pre-scan carried on and could give a
Packit Service 02e2fd
misleading incorrect error message. For example, /(?J)(?'a'))(?'a')/ gave a
Packit Service 02e2fd
message about invalid duplicate group names.
Packit Service 02e2fd
Packit Service 02e2fd
10. It has happened that pcre2test was accidentally linked with another POSIX
Packit Service 02e2fd
regex library instead of libpcre2-posix. In this situation, a call to regcomp()
Packit Service 02e2fd
(in the other library) may succeed, returning zero, but of course putting its
Packit Service 02e2fd
own data into the regex_t block. In one example the re_pcre2_code field was
Packit Service 02e2fd
left as NULL, which made pcre2test think it had not got a compiled POSIX regex,
Packit Service 02e2fd
so it treated the next line as another pattern line, resulting in a confusing
Packit Service 02e2fd
error message. A check has been added to pcre2test to see if the data returned
Packit Service 02e2fd
from a successful call of regcomp() are valid for PCRE2's regcomp(). If they
Packit Service 02e2fd
are not, an error message is output and the pcre2test run is abandoned. The
Packit Service 02e2fd
message points out the possibility of a mis-linking. Hopefully this will avoid
Packit Service 02e2fd
some head-scratching the next time this happens.
Packit Service 02e2fd
Packit Service 02e2fd
11. A pattern such as /(?<=((?C)0))/, which has a callout inside a lookbehind
Packit Service 02e2fd
assertion, caused pcre2test to output a very large number of spaces when the
Packit Service 02e2fd
callout was taken, making the program appearing to loop.
Packit Service 02e2fd
Packit Service 02e2fd
12. A pattern that included (*ACCEPT) in the middle of a sufficiently deeply
Packit Service 02e2fd
nested set of parentheses of sufficient size caused an overflow of the
Packit Service 02e2fd
compiling workspace (which was diagnosed, but of course is not desirable).
Packit Service 02e2fd
Packit Service 02e2fd
13. Detect missing closing parentheses during the pre-pass for group
Packit Service 02e2fd
identification.
Packit Service 02e2fd
Packit Service 02e2fd
14. Changed some integer variable types and put in a number of casts, following
Packit Service 02e2fd
a report of compiler warnings from Visual Studio 2013 and a few tests with
Packit Service 02e2fd
gcc's -Wconversion (which still throws up a lot).
Packit Service 02e2fd
Packit Service 02e2fd
15. Implemented pcre2_code_copy(), and added pushcopy and #popcopy to pcre2test
Packit Service 02e2fd
for testing it.
Packit Service 02e2fd
Packit Service 02e2fd
16. Change 66 for 10.21 introduced the use of snprintf() in PCRE2's version of
Packit Service 02e2fd
regerror(). When the error buffer is too small, my version of snprintf() puts a
Packit Service 02e2fd
binary zero in the final byte. Bug #1801 seems to show that other versions do
Packit Service 02e2fd
not do this, leading to bad output from pcre2test when it was checking for
Packit Service 02e2fd
buffer overflow. It no longer assumes a binary zero at the end of a too-small
Packit Service 02e2fd
regerror() buffer.
Packit Service 02e2fd
Packit Service 02e2fd
17. Fixed typo ("&&" for "&") in pcre2_study(). Fortunately, this could not
Packit Service 02e2fd
actually affect anything, by sheer luck.
Packit Service 02e2fd
Packit Service 02e2fd
18. Two minor fixes for MSVC compilation: (a) removal of apparently incorrect
Packit Service 02e2fd
"const" qualifiers in pcre2test and (b) defining snprintf as _snprintf for
Packit Service 02e2fd
older MSVC compilers. This has been done both in src/pcre2_internal.h for most
Packit Service 02e2fd
of the library, and also in src/pcre2posix.c, which no longer includes
Packit Service 02e2fd
pcre2_internal.h (see 24 below).
Packit Service 02e2fd
Packit Service 02e2fd
19. Applied Chris Wilson's patch (Bugzilla #1681) to CMakeLists.txt for MSVC
Packit Service 02e2fd
static compilation. Subsequently applied Chris Wilson's second patch, putting
Packit Service 02e2fd
the first patch under a new option instead of being unconditional when
Packit Service 02e2fd
PCRE_STATIC is set.
Packit Service 02e2fd
Packit Service 02e2fd
20. Updated pcre2grep to set stdout as binary when run under Windows, so as not
Packit Service 02e2fd
to convert \r\n at the ends of reflected lines into \r\r\n. This required
Packit Service 02e2fd
ensuring that other output that is written to stdout (e.g. file names) uses the
Packit Service 02e2fd
appropriate line terminator: \r\n for Windows, \n otherwise.
Packit Service 02e2fd
Packit Service 02e2fd
21. When a line is too long for pcre2grep's internal buffer, show the maximum
Packit Service 02e2fd
length in the error message.
Packit Service 02e2fd
Packit Service 02e2fd
22. Added support for string callouts to pcre2grep (Zoltan's patch with PH
Packit Service 02e2fd
additions).
Packit Service 02e2fd
Packit Service 02e2fd
23. RunTest.bat was missing a "set type" line for test 22.
Packit Service 02e2fd
Packit Service 02e2fd
24. The pcre2posix.c file was including pcre2_internal.h, and using some
Packit Service 02e2fd
"private" knowledge of the data structures. This is unnecessary; the code has
Packit Service 02e2fd
been re-factored and no longer includes pcre2_internal.h.
Packit Service 02e2fd
Packit Service 02e2fd
25. A racing condition is fixed in JIT reported by Mozilla.
Packit Service 02e2fd
Packit Service 02e2fd
26. Minor code refactor to avoid "array subscript is below array bounds"
Packit Service 02e2fd
compiler warning.
Packit Service 02e2fd
Packit Service 02e2fd
27. Minor code refactor to avoid "left shift of negative number" warning.
Packit Service 02e2fd
Packit Service 02e2fd
28. Add a bit more sanity checking to pcre2_serialize_decode() and document
Packit Service 02e2fd
that it expects trusted data.
Packit Service 02e2fd
Packit Service 02e2fd
29. Fix typo in pcre2_jit_test.c
Packit Service 02e2fd
Packit Service 02e2fd
30. Due to an oversight, pcre2grep was not making use of JIT when available.
Packit Service 02e2fd
This is now fixed.
Packit Service 02e2fd
Packit Service 02e2fd
31. The RunGrepTest script is updated to use the valgrind suppressions file
Packit Service 02e2fd
when testing with JIT under valgrind (compare 10.21/51 below). The suppressions
Packit Service 02e2fd
file is updated so that is now the same as for PCRE1: it suppresses the
Packit Service 02e2fd
Memcheck warnings Addr16 and Cond in unknown objects (that is, JIT-compiled
Packit Service 02e2fd
code). Also changed smc-check=all to smc-check=all-non-file as was done for
Packit Service 02e2fd
RunTest (see 4 above).
Packit Service 02e2fd
Packit Service 02e2fd
32. Implemented the PCRE2_NO_JIT option for pcre2_match().
Packit Service 02e2fd
Packit Service 02e2fd
33. Fix typo that gave a compiler error when JIT not supported.
Packit Service 02e2fd
Packit Service 02e2fd
34. Fix comment describing the returns from find_fixedlength().
Packit Service 02e2fd
Packit Service 02e2fd
35. Fix potential negative index in pcre2test.
Packit Service 02e2fd
Packit Service 02e2fd
36. Calls to pcre2_get_error_message() with error numbers that are never
Packit Service 02e2fd
returned by PCRE2 functions were returning empty strings. Now the error code
Packit Service 02e2fd
PCRE2_ERROR_BADDATA is returned. A facility has been added to pcre2test to
Packit Service 02e2fd
show the texts for given error numbers (i.e. to call pcre2_get_error_message()
Packit Service 02e2fd
and display what it returns) and a few representative error codes are now
Packit Service 02e2fd
checked in RunTest.
Packit Service 02e2fd
Packit Service 02e2fd
37. Added "&& !defined(__INTEL_COMPILER)" to the test for __GNUC__ in
Packit Service 02e2fd
pcre2_match.c, in anticipation that this is needed for the same reason it was
Packit Service 02e2fd
recently added to pcrecpp.cc in PCRE1.
Packit Service 02e2fd
Packit Service 02e2fd
38. Using -o with -M in pcre2grep could cause unnecessary repeated output when
Packit Service 02e2fd
the match extended over a line boundary, as it tried to find more matches "on
Packit Service 02e2fd
the same line" - but it was already over the end.
Packit Service 02e2fd
Packit Service 02e2fd
39. Allow \C in lookbehinds and DFA matching in UTF-32 mode (by converting it
Packit Service 02e2fd
to the same code as '.' when PCRE2_DOTALL is set).
Packit Service 02e2fd
Packit Service 02e2fd
40. Fix two clang compiler warnings in pcre2test when only one code unit width
Packit Service 02e2fd
is supported.
Packit Service 02e2fd
Packit Service 02e2fd
41. Upgrade RunTest to automatically re-run test 2 with a large (64MiB) stack
Packit Service 02e2fd
if it fails when running the interpreter with a 16MiB stack (and if changing
Packit Service 02e2fd
the stack size via pcre2test is possible). This avoids having to manually set a
Packit Service 02e2fd
large stack size when testing with clang.
Packit Service 02e2fd
Packit Service 02e2fd
42. Fix register overwite in JIT when SSE2 acceleration is enabled.
Packit Service 02e2fd
Packit Service 02e2fd
43. Detect integer overflow in pcre2test pattern and data repetition counts.
Packit Service 02e2fd
Packit Service 02e2fd
44. In pcre2test, ignore "allcaptures" after DFA matching.
Packit Service 02e2fd
Packit Service 02e2fd
45. Fix unaligned accesses on x86. Patch by Marc Mutz.
Packit Service 02e2fd
Packit Service 02e2fd
46. Fix some more clang compiler warnings.
Packit Service 02e2fd
Packit Service 02e2fd
Packit Service 02e2fd
Version 10.21 12-January-2016
Packit Service 02e2fd
-----------------------------
Packit Service 02e2fd
Packit Service 02e2fd
1. Improve matching speed of patterns starting with + or * in JIT.
Packit Service 02e2fd
Packit Service 02e2fd
2. Use memchr() to find the first character in an unanchored match in 8-bit
Packit Service 02e2fd
mode in the interpreter. This gives a significant speed improvement.
Packit Service 02e2fd
Packit Service 02e2fd
3. Removed a redundant copy of the opcode_possessify table in the
Packit Service 02e2fd
pcre2_auto_possessify.c source.
Packit Service 02e2fd
Packit Service 02e2fd
4. Fix typos in dftables.c for z/OS.
Packit Service 02e2fd
Packit Service 02e2fd
5. Change 36 for 10.20 broke the handling of [[:>:]] and [[:<:]] in that
Packit Service 02e2fd
processing them could involve a buffer overflow if the following character was
Packit Service 02e2fd
an opening parenthesis.
Packit Service 02e2fd
Packit Service 02e2fd
6. Change 36 for 10.20 also introduced a bug in processing this pattern:
Packit Service 02e2fd
/((?x)(*:0))#(?'/. Specifically: if a setting of (?x) was followed by a (*MARK)
Packit Service 02e2fd
setting (which (*:0) is), then (?x) did not get unset at the end of its group
Packit Service 02e2fd
during the scan for named groups, and hence the external # was incorrectly
Packit Service 02e2fd
treated as a comment and the invalid (?' at the end of the pattern was not
Packit Service 02e2fd
diagnosed. This caused a buffer overflow during the real compile. This bug was
Packit Service 02e2fd
discovered by Karl Skomski with the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
7. Moved the pcre2_find_bracket() function from src/pcre2_compile.c into its
Packit Service 02e2fd
own source module to avoid a circular dependency between src/pcre2_compile.c
Packit Service 02e2fd
and src/pcre2_study.c
Packit Service 02e2fd
Packit Service 02e2fd
8. A callout with a string argument containing an opening square bracket, for
Packit Service 02e2fd
example /(?C$[$)(?<]/, was incorrectly processed and could provoke a buffer
Packit Service 02e2fd
overflow. This bug was discovered by Karl Skomski with the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
9. The handling of callouts during the pre-pass for named group identification
Packit Service 02e2fd
has been tightened up.
Packit Service 02e2fd
Packit Service 02e2fd
10. The quantifier {1} can be ignored, whether greedy, non-greedy, or
Packit Service 02e2fd
possessive. This is a very minor optimization.
Packit Service 02e2fd
Packit Service 02e2fd
11. A possessively repeated conditional group that could match an empty string,
Packit Service 02e2fd
for example, /(?(R))*+/, was incorrectly compiled.
Packit Service 02e2fd
Packit Service 02e2fd
12. The Unicode tables have been updated to Unicode 8.0.0 (thanks to Christian
Packit Service 02e2fd
Persch).
Packit Service 02e2fd
Packit Service 02e2fd
13. An empty comment (?#) in a pattern was incorrectly processed and could
Packit Service 02e2fd
provoke a buffer overflow. This bug was discovered by Karl Skomski with the
Packit Service 02e2fd
LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
14. Fix infinite recursion in the JIT compiler when certain patterns such as
Packit Service 02e2fd
/(?:|a|){100}x/ are analysed.
Packit Service 02e2fd
Packit Service 02e2fd
15. Some patterns with character classes involving [: and \\ were incorrectly
Packit Service 02e2fd
compiled and could cause reading from uninitialized memory or an incorrect
Packit Service 02e2fd
error diagnosis. Examples are: /[[:\\](?<[::]/ and /[[:\\](?'abc')[a:]. The
Packit Service 02e2fd
first of these bugs was discovered by Karl Skomski with the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
16. Pathological patterns containing many nested occurrences of [: caused
Packit Service 02e2fd
pcre2_compile() to run for a very long time. This bug was found by the LLVM
Packit Service 02e2fd
fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
17. A missing closing parenthesis for a callout with a string argument was not
Packit Service 02e2fd
being diagnosed, possibly leading to a buffer overflow. This bug was found by
Packit Service 02e2fd
the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
18. A conditional group with only one branch has an implicit empty alternative
Packit Service 02e2fd
branch and must therefore be treated as potentially matching an empty string.
Packit Service 02e2fd
Packit Service 02e2fd
19. If (?R was followed by - or + incorrect behaviour happened instead of a
Packit Service 02e2fd
diagnostic. This bug was discovered by Karl Skomski with the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
20. Another bug that was introduced by change 36 for 10.20: conditional groups
Packit Service 02e2fd
whose condition was an assertion preceded by an explicit callout with a string
Packit Service 02e2fd
argument might be incorrectly processed, especially if the string contained \Q.
Packit Service 02e2fd
This bug was discovered by Karl Skomski with the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
21. Compiling PCRE2 with the sanitize options of clang showed up a number of
Packit Service 02e2fd
very pedantic coding infelicities and a buffer overflow while checking a UTF-8
Packit Service 02e2fd
string if the final multi-byte UTF-8 character was truncated.
Packit Service 02e2fd
Packit Service 02e2fd
22. For Perl compatibility in EBCDIC environments, ranges such as a-z in a
Packit Service 02e2fd
class, where both values are literal letters in the same case, omit the
Packit Service 02e2fd
non-letter EBCDIC code points within the range.
Packit Service 02e2fd
Packit Service 02e2fd
23. Finding the minimum matching length of complex patterns with back
Packit Service 02e2fd
references and/or recursions can take a long time. There is now a cut-off that
Packit Service 02e2fd
gives up trying to find a minimum length when things get too complex.
Packit Service 02e2fd
Packit Service 02e2fd
24. An optimization has been added that speeds up finding the minimum matching
Packit Service 02e2fd
length for patterns containing repeated capturing groups or recursions.
Packit Service 02e2fd
Packit Service 02e2fd
25. If a pattern contained a back reference to a group whose number was
Packit Service 02e2fd
duplicated as a result of appearing in a (?|...) group, the computation of the
Packit Service 02e2fd
minimum matching length gave a wrong result, which could cause incorrect "no
Packit Service 02e2fd
match" errors. For such patterns, a minimum matching length cannot at present
Packit Service 02e2fd
be computed.
Packit Service 02e2fd
Packit Service 02e2fd
26. Added a check for integer overflow in conditions (?(<digits>) and
Packit Service 02e2fd
(?(R<digits>). This omission was discovered by Karl Skomski with the LLVM
Packit Service 02e2fd
fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
27. Fixed an issue when \p{Any} inside an xclass did not read the current
Packit Service 02e2fd
character.
Packit Service 02e2fd
Packit Service 02e2fd
28. If pcre2grep was given the -q option with -c or -l, or when handling a
Packit Service 02e2fd
binary file, it incorrectly wrote output to stdout.
Packit Service 02e2fd
Packit Service 02e2fd
29. The JIT compiler did not restore the control verb head in case of *THEN
Packit Service 02e2fd
control verbs. This issue was found by Karl Skomski with a custom LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
30. The way recursive references such as (?3) are compiled has been re-written
Packit Service 02e2fd
because the old way was the cause of many issues. Now, conversion of the group
Packit Service 02e2fd
number into a pattern offset does not happen until the pattern has been
Packit Service 02e2fd
completely compiled. This does mean that detection of all infinitely looping
Packit Service 02e2fd
recursions is postponed till match time. In the past, some easy ones were
Packit Service 02e2fd
detected at compile time. This re-writing was done in response to yet another
Packit Service 02e2fd
bug found by the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
31. A test for a back reference to a non-existent group was missing for items
Packit Service 02e2fd
such as \987. This caused incorrect code to be compiled. This issue was found
Packit Service 02e2fd
by Karl Skomski with a custom LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
32. Error messages for syntax errors following \g and \k were giving inaccurate
Packit Service 02e2fd
offsets in the pattern.
Packit Service 02e2fd
Packit Service 02e2fd
33. Improve the performance of starting single character repetitions in JIT.
Packit Service 02e2fd
Packit Service 02e2fd
34. (*LIMIT_MATCH=) now gives an error instead of setting the value to 0.
Packit Service 02e2fd
Packit Service 02e2fd
35. Error messages for syntax errors in *LIMIT_MATCH and *LIMIT_RECURSION now
Packit Service 02e2fd
give the right offset instead of zero.
Packit Service 02e2fd
Packit Service 02e2fd
36. The JIT compiler should not check repeats after a {0,1} repeat byte code.
Packit Service 02e2fd
This issue was found by Karl Skomski with a custom LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
37. The JIT compiler should restore the control chain for empty possessive
Packit Service 02e2fd
repeats. This issue was found by Karl Skomski with a custom LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
38. A bug which was introduced by the single character repetition optimization
Packit Service 02e2fd
was fixed.
Packit Service 02e2fd
Packit Service 02e2fd
39. Match limit check added to recursion. This issue was found by Karl Skomski
Packit Service 02e2fd
with a custom LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
40. Arrange for the UTF check in pcre2_match() and pcre2_dfa_match() to look
Packit Service 02e2fd
only at the part of the subject that is relevant when the starting offset is
Packit Service 02e2fd
non-zero.
Packit Service 02e2fd
Packit Service 02e2fd
41. Improve first character match in JIT with SSE2 on x86.
Packit Service 02e2fd
Packit Service 02e2fd
42. Fix two assertion fails in JIT. These issues were found by Karl Skomski
Packit Service 02e2fd
with a custom LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
43. Correct the setting of CMAKE_C_FLAGS in CMakeLists.txt (patch from Roy Ivy
Packit Service 02e2fd
III).
Packit Service 02e2fd
Packit Service 02e2fd
44. Fix bug in RunTest.bat for new test 14, and adjust the script for the added
Packit Service 02e2fd
test (there are now 20 in total).
Packit Service 02e2fd
Packit Service 02e2fd
45. Fixed a corner case of range optimization in JIT.
Packit Service 02e2fd
Packit Service 02e2fd
46. Add the ${*MARK} facility to pcre2_substitute().
Packit Service 02e2fd
Packit Service 02e2fd
47. Modifier lists in pcre2test were splitting at spaces without the required
Packit Service 02e2fd
commas.
Packit Service 02e2fd
Packit Service 02e2fd
48. Implemented PCRE2_ALT_VERBNAMES.
Packit Service 02e2fd
Packit Service 02e2fd
49. Fixed two issues in JIT. These were found by Karl Skomski with a custom
Packit Service 02e2fd
LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
50. The pcre2test program has been extended by adding the #newline_default
Packit Service 02e2fd
command. This has made it possible to run the standard tests when PCRE2 is
Packit Service 02e2fd
compiled with either CR or CRLF as the default newline convention. As part of
Packit Service 02e2fd
this work, the new command was added to several test files and the testing
Packit Service 02e2fd
scripts were modified. The pcre2grep tests can now also be run when there is no
Packit Service 02e2fd
LF in the default newline convention.
Packit Service 02e2fd
Packit Service 02e2fd
51. The RunTest script has been modified so that, when JIT is used and valgrind
Packit Service 02e2fd
is specified, a valgrind suppressions file is set up to ignore "Invalid read of
Packit Service 02e2fd
size 16" errors because these are false positives when the hardware supports
Packit Service 02e2fd
the SSE2 instruction set.
Packit Service 02e2fd
Packit Service 02e2fd
52. It is now possible to have comment lines amid the subject strings in
Packit Service 02e2fd
pcre2test (and perltest.sh) input.
Packit Service 02e2fd
Packit Service 02e2fd
53. Implemented PCRE2_USE_OFFSET_LIMIT and pcre2_set_offset_limit().
Packit Service 02e2fd
Packit Service 02e2fd
54. Add the null_context modifier to pcre2test so that calling pcre2_compile()
Packit Service 02e2fd
and the matching functions with NULL contexts can be tested.
Packit Service 02e2fd
Packit Service 02e2fd
55. Implemented PCRE2_SUBSTITUTE_EXTENDED.
Packit Service 02e2fd
Packit Service 02e2fd
56. In a character class such as [\W\p{Any}] where both a negative-type escape
Packit Service 02e2fd
("not a word character") and a property escape were present, the property
Packit Service 02e2fd
escape was being ignored.
Packit Service 02e2fd
Packit Service 02e2fd
57. Fixed integer overflow for patterns whose minimum matching length is very,
Packit Service 02e2fd
very large.
Packit Service 02e2fd
Packit Service 02e2fd
58. Implemented --never-backslash-C.
Packit Service 02e2fd
Packit Service 02e2fd
59. Change 55 above introduced a bug by which certain patterns provoked the
Packit Service 02e2fd
erroneous error "\ at end of pattern".
Packit Service 02e2fd
Packit Service 02e2fd
60. The special sequences [[:<:]] and [[:>:]] gave rise to incorrect compiling
Packit Service 02e2fd
errors or other strange effects if compiled in UCP mode. Found with libFuzzer
Packit Service 02e2fd
and AddressSanitizer.
Packit Service 02e2fd
Packit Service 02e2fd
61. Whitespace at the end of a pcre2test pattern line caused a spurious error
Packit Service 02e2fd
message if there were only single-character modifiers. It should be ignored.
Packit Service 02e2fd
Packit Service 02e2fd
62. The use of PCRE2_NO_AUTO_CAPTURE could cause incorrect compilation results
Packit Service 02e2fd
or segmentation errors for some patterns. Found with libFuzzer and
Packit Service 02e2fd
AddressSanitizer.
Packit Service 02e2fd
Packit Service 02e2fd
63. Very long names in (*MARK) or (*THEN) etc. items could provoke a buffer
Packit Service 02e2fd
overflow.
Packit Service 02e2fd
Packit Service 02e2fd
64. Improve error message for overly-complicated patterns.
Packit Service 02e2fd
Packit Service 02e2fd
65. Implemented an optional replication feature for patterns in pcre2test, to
Packit Service 02e2fd
make it easier to test long repetitive patterns. The tests for 63 above are
Packit Service 02e2fd
converted to use the new feature.
Packit Service 02e2fd
Packit Service 02e2fd
66. In the POSIX wrapper, if regerror() was given too small a buffer, it could
Packit Service 02e2fd
misbehave.
Packit Service 02e2fd
Packit Service 02e2fd
67. In pcre2_substitute() in UTF mode, the UTF validity check on the
Packit Service 02e2fd
replacement string was happening before the length setting when the replacement
Packit Service 02e2fd
string was zero-terminated.
Packit Service 02e2fd
Packit Service 02e2fd
68. In pcre2_substitute() in UTF mode, PCRE2_NO_UTF_CHECK can be set for the
Packit Service 02e2fd
second and subsequent calls to pcre2_match().
Packit Service 02e2fd
Packit Service 02e2fd
69. There was no check for integer overflow for a replacement group number in
Packit Service 02e2fd
pcre2_substitute(). An added check for a number greater than the largest group
Packit Service 02e2fd
number in the pattern means this is not now needed.
Packit Service 02e2fd
Packit Service 02e2fd
70. The PCRE2-specific VERSION condition didn't work correctly if only one
Packit Service 02e2fd
digit was given after the decimal point, or if more than two digits were given.
Packit Service 02e2fd
It now works with one or two digits, and gives a compile time error if more are
Packit Service 02e2fd
given.
Packit Service 02e2fd
Packit Service 02e2fd
71. In pcre2_substitute() there was the possibility of reading one code unit
Packit Service 02e2fd
beyond the end of the replacement string.
Packit Service 02e2fd
Packit Service 02e2fd
72. The code for checking a subject's UTF-32 validity for a pattern with a
Packit Service 02e2fd
lookbehind involved an out-of-bounds pointer, which could potentially cause
Packit Service 02e2fd
trouble in some environments.
Packit Service 02e2fd
Packit Service 02e2fd
73. The maximum lookbehind length was incorrectly calculated for patterns such
Packit Service 02e2fd
as /(?<=(a)(?-1))x/ which have a recursion within a backreference.
Packit Service 02e2fd
Packit Service 02e2fd
74. Give an error if a lookbehind assertion is longer than 65535 code units.
Packit Service 02e2fd
Packit Service 02e2fd
75. Give an error in pcre2_substitute() if a match ends before it starts (as a
Packit Service 02e2fd
result of the use of \K).
Packit Service 02e2fd
Packit Service 02e2fd
76. Check the length of subpattern names and the names in (*MARK:xx) etc.
Packit Service 02e2fd
dynamically to avoid the possibility of integer overflow.
Packit Service 02e2fd
Packit Service 02e2fd
77. Implement pcre2_set_max_pattern_length() so that programs can restrict the
Packit Service 02e2fd
size of patterns that they are prepared to handle.
Packit Service 02e2fd
Packit Service 02e2fd
78. (*NO_AUTO_POSSESS) was not working.
Packit Service 02e2fd
Packit Service 02e2fd
79. Adding group information caching improves the speed of compiling when
Packit Service 02e2fd
checking whether a group has a fixed length and/or could match an empty string,
Packit Service 02e2fd
especially when recursion or subroutine calls are involved. However, this
Packit Service 02e2fd
cannot be used when (?| is present in the pattern because the same number may
Packit Service 02e2fd
be used for groups of different sizes. To catch runaway patterns in this
Packit Service 02e2fd
situation, counts have been introduced to the functions that scan for empty
Packit Service 02e2fd
branches or compute fixed lengths.
Packit Service 02e2fd
Packit Service 02e2fd
80. Allow for the possibility of the size of the nest_save structure not being
Packit Service 02e2fd
a factor of the size of the compiling workspace (it currently is).
Packit Service 02e2fd
Packit Service 02e2fd
81. Check for integer overflow in minimum length calculation and cap it at
Packit Service 02e2fd
65535.
Packit Service 02e2fd
Packit Service 02e2fd
82. Small optimizations in code for finding the minimum matching length.
Packit Service 02e2fd
Packit Service 02e2fd
83. Lock out configuring for EBCDIC with non-8-bit libraries.
Packit Service 02e2fd
Packit Service 02e2fd
84. Test for error code <= 0 in regerror().
Packit Service 02e2fd
Packit Service 02e2fd
85. Check for too many replacements (more than INT_MAX) in pcre2_substitute().
Packit Service 02e2fd
Packit Service 02e2fd
86. Avoid the possibility of computing with an out-of-bounds pointer (though
Packit Service 02e2fd
not dereferencing it) while handling lookbehind assertions.
Packit Service 02e2fd
Packit Service 02e2fd
87. Failure to get memory for the match data in regcomp() is now given as a
Packit Service 02e2fd
regcomp() error instead of waiting for regexec() to pick it up.
Packit Service 02e2fd
Packit Service 02e2fd
88. In pcre2_substitute(), ensure that CRLF is not split when it is a valid
Packit Service 02e2fd
newline sequence.
Packit Service 02e2fd
Packit Service 02e2fd
89. Paranoid check in regcomp() for bad error code from pcre2_compile().
Packit Service 02e2fd
Packit Service 02e2fd
90. Run test 8 (internal offsets and code sizes) for link sizes 3 and 4 as well
Packit Service 02e2fd
as for link size 2.
Packit Service 02e2fd
Packit Service 02e2fd
91. Document that JIT has a limit on pattern size, and give more information
Packit Service 02e2fd
about JIT compile failures in pcre2test.
Packit Service 02e2fd
Packit Service 02e2fd
92. Implement PCRE2_INFO_HASBACKSLASHC.
Packit Service 02e2fd
Packit Service 02e2fd
93. Re-arrange valgrind support code in pcre2test to avoid spurious reports
Packit Service 02e2fd
with JIT (possibly caused by SSE2?).
Packit Service 02e2fd
Packit Service 02e2fd
94. Support offset_limit in JIT.
Packit Service 02e2fd
Packit Service 02e2fd
95. A sequence such as [[:punct:]b] that is, a POSIX character class followed
Packit Service 02e2fd
by a single ASCII character in a class item, was incorrectly compiled in UCP
Packit Service 02e2fd
mode. The POSIX class got lost, but only if the single character followed it.
Packit Service 02e2fd
Packit Service 02e2fd
96. [:punct:] in UCP mode was matching some characters in the range 128-255
Packit Service 02e2fd
that should not have been matched.
Packit Service 02e2fd
Packit Service 02e2fd
97. If [:^ascii:] or [:^xdigit:] are present in a non-negated class, all
Packit Service 02e2fd
characters with code points greater than 255 are in the class. When a Unicode
Packit Service 02e2fd
property was also in the class (if PCRE2_UCP is set, escapes such as \w are
Packit Service 02e2fd
turned into Unicode properties), wide characters were not correctly handled,
Packit Service 02e2fd
and could fail to match.
Packit Service 02e2fd
Packit Service 02e2fd
98. In pcre2test, make the "startoffset" modifier a synonym of "offset",
Packit Service 02e2fd
because it sets the "startoffset" parameter for pcre2_match().
Packit Service 02e2fd
Packit Service 02e2fd
99. If PCRE2_AUTO_CALLOUT was set on a pattern that had a (?# comment between
Packit Service 02e2fd
an item and its qualifier (for example, A(?#comment)?B) pcre2_compile()
Packit Service 02e2fd
misbehaved. This bug was found by the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
100. The error for an invalid UTF pattern string always gave the code unit
Packit Service 02e2fd
offset as zero instead of where the invalidity was found.
Packit Service 02e2fd
Packit Service 02e2fd
101. Further to 97 above, negated classes such as [^[:^ascii:]\d] were also not
Packit Service 02e2fd
working correctly in UCP mode.
Packit Service 02e2fd
Packit Service 02e2fd
102. Similar to 99 above, if an isolated \E was present between an item and its
Packit Service 02e2fd
qualifier when PCRE2_AUTO_CALLOUT was set, pcre2_compile() misbehaved. This bug
Packit Service 02e2fd
was found by the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
103. The POSIX wrapper function regexec() crashed if the option REG_STARTEND
Packit Service 02e2fd
was set when the pmatch argument was NULL. It now returns REG_INVARG.
Packit Service 02e2fd
Packit Service 02e2fd
104. Allow for up to 32-bit numbers in the ordin() function in pcre2grep.
Packit Service 02e2fd
Packit Service 02e2fd
105. An empty \Q\E sequence between an item and its qualifier caused
Packit Service 02e2fd
pcre2_compile() to misbehave when auto callouts were enabled. This bug
Packit Service 02e2fd
was found by the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
106. If both PCRE2_ALT_VERBNAMES and PCRE2_EXTENDED were set, and a (*MARK) or
Packit Service 02e2fd
other verb "name" ended with whitespace immediately before the closing
Packit Service 02e2fd
parenthesis, pcre2_compile() misbehaved. Example: /(*:abc )/, but only when
Packit Service 02e2fd
both those options were set.
Packit Service 02e2fd
Packit Service 02e2fd
107. In a number of places pcre2_compile() was not handling NULL characters
Packit Service 02e2fd
correctly, and pcre2test with the "bincode" modifier was not always correctly
Packit Service 02e2fd
displaying fields containing NULLS:
Packit Service 02e2fd
Packit Service 02e2fd
   (a) Within /x extended #-comments
Packit Service 02e2fd
   (b) Within the "name" part of (*MARK) and other *verbs
Packit Service 02e2fd
   (c) Within the text argument of a callout
Packit Service 02e2fd
Packit Service 02e2fd
108. If a pattern that was compiled with PCRE2_EXTENDED started with white
Packit Service 02e2fd
space or a #-type comment that was followed by (?-x), which turns off
Packit Service 02e2fd
PCRE2_EXTENDED, and there was no subsequent (?x) to turn it on again,
Packit Service 02e2fd
pcre2_compile() assumed that (?-x) applied to the whole pattern and
Packit Service 02e2fd
consequently mis-compiled it. This bug was found by the LLVM fuzzer. The fix
Packit Service 02e2fd
for this bug means that a setting of any of the (?imsxJU) options at the start
Packit Service 02e2fd
of a pattern is no longer transferred to the options that are returned by
Packit Service 02e2fd
PCRE2_INFO_ALLOPTIONS. In fact, this was an anachronism that should have
Packit Service 02e2fd
changed when the effects of those options were all moved to compile time.
Packit Service 02e2fd
Packit Service 02e2fd
109. An escaped closing parenthesis in the "name" part of a (*verb) when
Packit Service 02e2fd
PCRE2_ALT_VERBNAMES was set caused pcre2_compile() to malfunction. This bug
Packit Service 02e2fd
was found by the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
110. Implemented PCRE2_SUBSTITUTE_UNSET_EMPTY, and updated pcre2test to make it
Packit Service 02e2fd
possible to test it.
Packit Service 02e2fd
Packit Service 02e2fd
111. "Harden" pcre2test against ridiculously large values in modifiers and
Packit Service 02e2fd
command line arguments.
Packit Service 02e2fd
Packit Service 02e2fd
112. Implemented PCRE2_SUBSTITUTE_UNKNOWN_UNSET and PCRE2_SUBSTITUTE_OVERFLOW_
Packit Service 02e2fd
LENGTH.
Packit Service 02e2fd
Packit Service 02e2fd
113. Fix printing of *MARK names that contain binary zeroes in pcre2test.
Packit Service 02e2fd
Packit Service 02e2fd
Packit Service 02e2fd
Version 10.20 30-June-2015
Packit Service 02e2fd
--------------------------
Packit Service 02e2fd
Packit Service 02e2fd
1. Callouts with string arguments have been added.
Packit Service 02e2fd
Packit Service 02e2fd
2. Assertion code generator in JIT has been optimized.
Packit Service 02e2fd
Packit Service 02e2fd
3. The invalid pattern (?(?C) has a missing assertion condition at the end. The
Packit Service 02e2fd
pcre2_compile() function read past the end of the input before diagnosing an
Packit Service 02e2fd
error. This bug was discovered by the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
4. Implemented pcre2_callout_enumerate().
Packit Service 02e2fd
Packit Service 02e2fd
5. Fix JIT compilation of conditional blocks whose assertion is converted to
Packit Service 02e2fd
(*FAIL). E.g: /(?(?!))/.
Packit Service 02e2fd
Packit Service 02e2fd
6. The pattern /(?(?!)^)/ caused references to random memory. This bug was
Packit Service 02e2fd
discovered by the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
7. The assertion (?!) is optimized to (*FAIL). This was not handled correctly
Packit Service 02e2fd
when this assertion was used as a condition, for example (?(?!)a|b). In
Packit Service 02e2fd
pcre2_match() it worked by luck; in pcre2_dfa_match() it gave an incorrect
Packit Service 02e2fd
error about an unsupported item.
Packit Service 02e2fd
Packit Service 02e2fd
8. For some types of pattern, for example /Z*(|d*){216}/, the auto-
Packit Service 02e2fd
possessification code could take exponential time to complete. A recursion
Packit Service 02e2fd
depth limit of 1000 has been imposed to limit the resources used by this
Packit Service 02e2fd
optimization. This infelicity was discovered by the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
9. A pattern such as /(*UTF)[\S\V\H]/, which contains a negated special class
Packit Service 02e2fd
such as \S in non-UCP mode, explicit wide characters (> 255) can be ignored
Packit Service 02e2fd
because \S ensures they are all in the class. The code for doing this was
Packit Service 02e2fd
interacting badly with the code for computing the amount of space needed to
Packit Service 02e2fd
compile the pattern, leading to a buffer overflow. This bug was discovered by
Packit Service 02e2fd
the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
10. A pattern such as /((?2)+)((?1))/ which has mutual recursion nested inside
Packit Service 02e2fd
other kinds of group caused stack overflow at compile time. This bug was
Packit Service 02e2fd
discovered by the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
11. A pattern such as /(?1)(?#?'){8}(a)/ which had a parenthesized comment
Packit Service 02e2fd
between a subroutine call and its quantifier was incorrectly compiled, leading
Packit Service 02e2fd
to buffer overflow or other errors. This bug was discovered by the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
12. The illegal pattern /(?(?<E>.*!.*)?)/ was not being diagnosed as missing an
Packit Service 02e2fd
assertion after (?(. The code was failing to check the character after (?(?<
Packit Service 02e2fd
for the ! or = that would indicate a lookbehind assertion. This bug was
Packit Service 02e2fd
discovered by the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
13. A pattern such as /X((?2)()*+){2}+/ which has a possessive quantifier with
Packit Service 02e2fd
a fixed maximum following a group that contains a subroutine reference was
Packit Service 02e2fd
incorrectly compiled and could trigger buffer overflow. This bug was discovered
Packit Service 02e2fd
by the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
14. Negative relative recursive references such as (?-7) to non-existent
Packit Service 02e2fd
subpatterns were not being diagnosed and could lead to unpredictable behaviour.
Packit Service 02e2fd
This bug was discovered by the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
15. The bug fixed in 14 was due to an integer variable that was unsigned when
Packit Service 02e2fd
it should have been signed. Some other "int" variables, having been checked,
Packit Service 02e2fd
have either been changed to uint32_t or commented as "must be signed".
Packit Service 02e2fd
Packit Service 02e2fd
16. A mutual recursion within a lookbehind assertion such as (?<=((?2))((?1)))
Packit Service 02e2fd
caused a stack overflow instead of the diagnosis of a non-fixed length
Packit Service 02e2fd
lookbehind assertion. This bug was discovered by the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
17. The use of \K in a positive lookbehind assertion in a non-anchored pattern
Packit Service 02e2fd
(e.g. /(?<=\Ka)/) could make pcre2grep loop.
Packit Service 02e2fd
Packit Service 02e2fd
18. There was a similar problem to 17 in pcre2test for global matches, though
Packit Service 02e2fd
the code there did catch the loop.
Packit Service 02e2fd
Packit Service 02e2fd
19. If a greedy quantified \X was preceded by \C in UTF mode (e.g. \C\X*),
Packit Service 02e2fd
and a subsequent item in the pattern caused a non-match, backtracking over the
Packit Service 02e2fd
repeated \X did not stop, but carried on past the start of the subject, causing
Packit Service 02e2fd
reference to random memory and/or a segfault. There were also some other cases
Packit Service 02e2fd
where backtracking after \C could crash. This set of bugs was discovered by the
Packit Service 02e2fd
LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
20. The function for finding the minimum length of a matching string could take
Packit Service 02e2fd
a very long time if mutual recursion was present many times in a pattern, for
Packit Service 02e2fd
example, /((?2){73}(?2))((?1))/. A better mutual recursion detection method has
Packit Service 02e2fd
been implemented. This infelicity was discovered by the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
21. Implemented PCRE2_NEVER_BACKSLASH_C.
Packit Service 02e2fd
Packit Service 02e2fd
22. The feature for string replication in pcre2test could read from freed
Packit Service 02e2fd
memory if the replication required a buffer to be extended, and it was not
Packit Service 02e2fd
working properly in 16-bit and 32-bit modes. This issue was discovered by a
Packit Service 02e2fd
fuzzer: see http://lcamtuf.coredump.cx/afl/.
Packit Service 02e2fd
Packit Service 02e2fd
23. Added the PCRE2_ALT_CIRCUMFLEX option.
Packit Service 02e2fd
Packit Service 02e2fd
24. Adjust the treatment of \8 and \9 to be the same as the current Perl
Packit Service 02e2fd
behaviour.
Packit Service 02e2fd
Packit Service 02e2fd
25. Static linking against the PCRE2 library using the pkg-config module was
Packit Service 02e2fd
failing on missing pthread symbols.
Packit Service 02e2fd
Packit Service 02e2fd
26. If a group that contained a recursive back reference also contained a
Packit Service 02e2fd
forward reference subroutine call followed by a non-forward-reference
Packit Service 02e2fd
subroutine call, for example /.((?2)(?R)\1)()/, pcre2_compile() failed to
Packit Service 02e2fd
compile correct code, leading to undefined behaviour or an internally detected
Packit Service 02e2fd
error. This bug was discovered by the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
27. Quantification of certain items (e.g. atomic back references) could cause
Packit Service 02e2fd
incorrect code to be compiled when recursive forward references were involved.
Packit Service 02e2fd
For example, in this pattern: /(?1)()((((((\1++))\x85)+)|))/. This bug was
Packit Service 02e2fd
discovered by the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
28. A repeated conditional group whose condition was a reference by name caused
Packit Service 02e2fd
a buffer overflow if there was more than one group with the given name. This
Packit Service 02e2fd
bug was discovered by the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
29. A recursive back reference by name within a group that had the same name as
Packit Service 02e2fd
another group caused a buffer overflow. For example: /(?J)(?'d'(?'d'\g{d}))/.
Packit Service 02e2fd
This bug was discovered by the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
30. A forward reference by name to a group whose number is the same as the
Packit Service 02e2fd
current group, for example in this pattern: /(?|(\k'Pm')|(?'Pm'))/, caused a
Packit Service 02e2fd
buffer overflow at compile time. This bug was discovered by the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
31. Fix -fsanitize=undefined warnings for left shifts of 1 by 31 (it treats 1
Packit Service 02e2fd
as an int; fixed by writing it as 1u).
Packit Service 02e2fd
Packit Service 02e2fd
32. Fix pcre2grep compile when -std=c99 is used with gcc, though it still gives
Packit Service 02e2fd
a warning for "fileno" unless -std=gnu99 us used.
Packit Service 02e2fd
Packit Service 02e2fd
33. A lookbehind assertion within a set of mutually recursive subpatterns could
Packit Service 02e2fd
provoke a buffer overflow. This bug was discovered by the LLVM fuzzer.
Packit Service 02e2fd
Packit Service 02e2fd
34. Give an error for an empty subpattern name such as (?'').
Packit Service 02e2fd
Packit Service 02e2fd
35. Make pcre2test give an error if a pattern that follows #forbud_utf contains
Packit Service 02e2fd
\P, \p, or \X.
Packit Service 02e2fd
Packit Service 02e2fd
36. The way named subpatterns are handled has been refactored. There is now a
Packit Service 02e2fd
pre-pass over the regex which does nothing other than identify named
Packit Service 02e2fd
subpatterns and count the total captures. This means that information about
Packit Service 02e2fd
named patterns is known before the rest of the compile. In particular, it means
Packit Service 02e2fd
that forward references can be checked as they are encountered. Previously, the
Packit Service 02e2fd
code for handling forward references was contorted and led to several errors in
Packit Service 02e2fd
computing the memory requirements for some patterns, leading to buffer
Packit Service 02e2fd
overflows.
Packit Service 02e2fd
Packit Service 02e2fd
37. There was no check for integer overflow in subroutine calls such as (?123).
Packit Service 02e2fd
Packit Service 02e2fd
38. The table entry for \l in EBCDIC environments was incorrect, leading to its
Packit Service 02e2fd
being treated as a literal 'l' instead of causing an error.
Packit Service 02e2fd
Packit Service 02e2fd
39. If a non-capturing group containing a conditional group that could match
Packit Service 02e2fd
an empty string was repeated, it was not identified as matching an empty string
Packit Service 02e2fd
itself. For example: /^(?:(?(1)x|)+)+$()/.
Packit Service 02e2fd
Packit Service 02e2fd
40. In an EBCDIC environment, pcretest was mishandling the escape sequences
Packit Service 02e2fd
\a and \e in test subject lines.
Packit Service 02e2fd
Packit Service 02e2fd
41. In an EBCDIC environment, \a in a pattern was converted to the ASCII
Packit Service 02e2fd
instead of the EBCDIC value.
Packit Service 02e2fd
Packit Service 02e2fd
42. The handling of \c in an EBCDIC environment has been revised so that it is
Packit Service 02e2fd
now compatible with the specification in Perl's perlebcdic page.
Packit Service 02e2fd
Packit Service 02e2fd
43. Single character repetition in JIT has been improved. 20-30% speedup
Packit Service 02e2fd
was achieved on certain patterns.
Packit Service 02e2fd
Packit Service 02e2fd
44. The EBCDIC character 0x41 is a non-breaking space, equivalent to 0xa0 in
Packit Service 02e2fd
ASCII/Unicode. This has now been added to the list of characters that are
Packit Service 02e2fd
recognized as white space in EBCDIC.
Packit Service 02e2fd
Packit Service 02e2fd
45. When PCRE2 was compiled without Unicode support, the use of \p and \P gave
Packit Service 02e2fd
an error (correctly) when used outside a class, but did not give an error
Packit Service 02e2fd
within a class.
Packit Service 02e2fd
Packit Service 02e2fd
46. \h within a class was incorrectly compiled in EBCDIC environments.
Packit Service 02e2fd
Packit Service 02e2fd
47. JIT should return with error when the compiled pattern requires
Packit Service 02e2fd
more stack space than the maximum.
Packit Service 02e2fd
Packit Service 02e2fd
48. Fixed a memory leak in pcre2grep when a locale is set.
Packit Service 02e2fd
Packit Service 02e2fd
Packit Service 02e2fd
Version 10.10 06-March-2015
Packit Service 02e2fd
---------------------------
Packit Service 02e2fd
Packit Service 02e2fd
1. When a pattern is compiled, it remembers the highest back reference so that
Packit Service 02e2fd
when matching, if the ovector is too small, extra memory can be obtained to
Packit Service 02e2fd
use instead. A conditional subpattern whose condition is a check on a capture
Packit Service 02e2fd
having happened, such as, for example in the pattern /^(?:(a)|b)(?(1)A|B)/, is
Packit Service 02e2fd
another kind of back reference, but it was not setting the highest
Packit Service 02e2fd
backreference number. This mattered only if pcre2_match() was called with an
Packit Service 02e2fd
ovector that was too small to hold the capture, and there was no other kind of
Packit Service 02e2fd
back reference (a situation which is probably quite rare). The effect of the
Packit Service 02e2fd
bug was that the condition was always treated as FALSE when the capture could
Packit Service 02e2fd
not be consulted, leading to a incorrect behaviour by pcre2_match(). This bug
Packit Service 02e2fd
has been fixed.
Packit Service 02e2fd
Packit Service 02e2fd
2. Functions for serialization and deserialization of sets of compiled patterns
Packit Service 02e2fd
have been added.
Packit Service 02e2fd
Packit Service 02e2fd
3. The value that is returned by PCRE2_INFO_SIZE has been corrected to remove
Packit Service 02e2fd
excess code units at the end of the data block that may occasionally occur if
Packit Service 02e2fd
the code for calculating the size over-estimates. This change stops the
Packit Service 02e2fd
serialization code copying uninitialized data, to which valgrind objects. The
Packit Service 02e2fd
documentation of PCRE2_INFO_SIZE was incorrect in stating that the size did not
Packit Service 02e2fd
include the general overhead. This has been corrected.
Packit Service 02e2fd
Packit Service 02e2fd
4. All code units in every slot in the table of group names are now set, again
Packit Service 02e2fd
in order to avoid accessing uninitialized data when serializing.
Packit Service 02e2fd
Packit Service 02e2fd
5. The (*NO_JIT) feature is implemented.
Packit Service 02e2fd
Packit Service 02e2fd
6. If a bug that caused pcre2_compile() to use more memory than allocated was
Packit Service 02e2fd
triggered when using valgrind, the code in (3) above passed a stupidly large
Packit Service 02e2fd
value to valgrind. This caused a crash instead of an "internal error" return.
Packit Service 02e2fd
Packit Service 02e2fd
7. A reference to a duplicated named group (either a back reference or a test
Packit Service 02e2fd
for being set in a conditional) that occurred in a part of the pattern where
Packit Service 02e2fd
PCRE2_DUPNAMES was not set caused the amount of memory needed for the pattern
Packit Service 02e2fd
to be incorrectly calculated, leading to overwriting.
Packit Service 02e2fd
Packit Service 02e2fd
8. A mutually recursive set of back references such as (\2)(\1) caused a
Packit Service 02e2fd
segfault at compile time (while trying to find the minimum matching length).
Packit Service 02e2fd
The infinite loop is now broken (with the minimum length unset, that is, zero).
Packit Service 02e2fd
Packit Service 02e2fd
9. If an assertion that was used as a condition was quantified with a minimum
Packit Service 02e2fd
of zero, matching went wrong. In particular, if the whole group had unlimited
Packit Service 02e2fd
repetition and could match an empty string, a segfault was likely. The pattern
Packit Service 02e2fd
(?(?=0)?)+ is an example that caused this. Perl allows assertions to be
Packit Service 02e2fd
quantified, but not if they are being used as conditions, so the above pattern
Packit Service 02e2fd
is faulted by Perl. PCRE2 has now been changed so that it also rejects such
Packit Service 02e2fd
patterns.
Packit Service 02e2fd
Packit Service 02e2fd
10. The error message for an invalid quantifier has been changed from "nothing
Packit Service 02e2fd
to repeat" to "quantifier does not follow a repeatable item".
Packit Service 02e2fd
Packit Service 02e2fd
11. If a bad UTF string is compiled with NO_UTF_CHECK, it may succeed, but
Packit Service 02e2fd
scanning the compiled pattern in subsequent auto-possessification can get out
Packit Service 02e2fd
of step and lead to an unknown opcode. Previously this could have caused an
Packit Service 02e2fd
infinite loop. Now it generates an "internal error" error. This is a tidyup,
Packit Service 02e2fd
not a bug fix; passing bad UTF with NO_UTF_CHECK is documented as having an
Packit Service 02e2fd
undefined outcome.
Packit Service 02e2fd
Packit Service 02e2fd
12. A UTF pattern containing a "not" match of a non-ASCII character and a
Packit Service 02e2fd
subroutine reference could loop at compile time. Example: /[^\xff]((?1))/.
Packit Service 02e2fd
Packit Service 02e2fd
13. The locale test (RunTest 3) has been upgraded. It now checks that a locale
Packit Service 02e2fd
that is found in the output of "locale -a" can actually be set by pcre2test
Packit Service 02e2fd
before it is accepted. Previously, in an environment where a locale was listed
Packit Service 02e2fd
but would not set (an example does exist), the test would "pass" without
Packit Service 02e2fd
actually doing anything. Also the fr_CA locale has been added to the list of
Packit Service 02e2fd
locales that can be used.
Packit Service 02e2fd
Packit Service 02e2fd
14. Fixed a bug in pcre2_substitute(). If a replacement string ended in a
Packit Service 02e2fd
capturing group number without parentheses, the last character was incorrectly
Packit Service 02e2fd
literally included at the end of the replacement string.
Packit Service 02e2fd
Packit Service 02e2fd
15. A possessive capturing group such as (a)*+ with a minimum repeat of zero
Packit Service 02e2fd
failed to allow the zero-repeat case if pcre2_match() was called with an
Packit Service 02e2fd
ovector too small to capture the group.
Packit Service 02e2fd
Packit Service 02e2fd
16. Improved error message in pcre2test when setting the stack size (-S) fails.
Packit Service 02e2fd
Packit Service 02e2fd
17. Fixed two bugs in CMakeLists.txt: (1) Some lines had got lost in the
Packit Service 02e2fd
transfer from PCRE1, meaning that CMake configuration failed if "build tests"
Packit Service 02e2fd
was selected. (2) The file src/pcre2_serialize.c had not been added to the list
Packit Service 02e2fd
of PCRE2 sources, which caused a failure to build pcre2test.
Packit Service 02e2fd
Packit Service 02e2fd
18. Fixed typo in pcre2_serialize.c (DECL instead of DEFN) that causes problems
Packit Service 02e2fd
only on Windows.
Packit Service 02e2fd
Packit Service 02e2fd
19. Use binary input when reading back saved serialized patterns in pcre2test.
Packit Service 02e2fd
Packit Service 02e2fd
20. Added RunTest.bat for running the tests under Windows.
Packit Service 02e2fd
Packit Service 02e2fd
21. "make distclean" was not removing config.h, a file that may be created for
Packit Service 02e2fd
use with CMake.
Packit Service 02e2fd
Packit Service 02e2fd
22. A pattern such as "((?2){0,1999}())?", which has a group containing a
Packit Service 02e2fd
forward reference repeated a large (but limited) number of times within a
Packit Service 02e2fd
repeated outer group that has a zero minimum quantifier, caused incorrect code
Packit Service 02e2fd
to be compiled, leading to the error "internal error: previously-checked
Packit Service 02e2fd
referenced subpattern not found" when an incorrect memory address was read.
Packit Service 02e2fd
This bug was reported as "heap overflow", discovered by Kai Lu of Fortinet's
Packit Service 02e2fd
FortiGuard Labs. (Added 24-March-2015: CVE-2015-2325 was given to this.)
Packit Service 02e2fd
Packit Service 02e2fd
23. A pattern such as "((?+1)(\1))/" containing a forward reference subroutine
Packit Service 02e2fd
call within a group that also contained a recursive back reference caused
Packit Service 02e2fd
incorrect code to be compiled. This bug was reported as "heap overflow",
Packit Service 02e2fd
discovered by Kai Lu of Fortinet's FortiGuard Labs. (Added 24-March-2015:
Packit Service 02e2fd
CVE-2015-2326 was given to this.)
Packit Service 02e2fd
Packit Service 02e2fd
24. Computing the size of the JIT read-only data in advance has been a source
Packit Service 02e2fd
of various issues, and new ones are still appear unfortunately. To fix
Packit Service 02e2fd
existing and future issues, size computation is eliminated from the code,
Packit Service 02e2fd
and replaced by on-demand memory allocation.
Packit Service 02e2fd
Packit Service 02e2fd
25. A pattern such as /(?i)[A-`]/, where characters in the other case are
Packit Service 02e2fd
adjacent to the end of the range, and the range contained characters with more
Packit Service 02e2fd
than one other case, caused incorrect behaviour when compiled in UTF mode. In
Packit Service 02e2fd
that example, the range a-j was left out of the class.
Packit Service 02e2fd
Packit Service 02e2fd
Packit Service 02e2fd
Version 10.00 05-January-2015
Packit Service 02e2fd
-----------------------------
Packit Service 02e2fd
Packit Service 02e2fd
Version 10.00 is the first release of PCRE2, a revised API for the PCRE
Packit Service 02e2fd
library. Changes prior to 10.00 are logged in the ChangeLog file for the old
Packit Service 02e2fd
API, up to item 20 for release 8.36.
Packit Service 02e2fd
Packit Service 02e2fd
The code of the library was heavily revised as part of the new API
Packit Service 02e2fd
implementation. Details of each and every modification were not individually
Packit Service 02e2fd
logged. In addition to the API changes, the following changes were made. They
Packit Service 02e2fd
are either new functionality, or bug fixes and other noticeable changes of
Packit Service 02e2fd
behaviour that were implemented after the code had been forked.
Packit Service 02e2fd
Packit Service 02e2fd
1. Including Unicode support at build time is now enabled by default, but it
Packit Service 02e2fd
can optionally be disabled. It is not enabled by default at run time (no
Packit Service 02e2fd
change).
Packit Service 02e2fd
Packit Service 02e2fd
2. The test program, now called pcre2test, was re-specified and almost
Packit Service 02e2fd
completely re-written. Its input is not compatible with input for pcretest.
Packit Service 02e2fd
Packit Service 02e2fd
3. Patterns may start with (*NOTEMPTY) or (*NOTEMPTY_ATSTART) to set the
Packit Service 02e2fd
PCRE2_NOTEMPTY or PCRE2_NOTEMPTY_ATSTART options for every subject line that is
Packit Service 02e2fd
matched by that pattern.
Packit Service 02e2fd
Packit Service 02e2fd
4. For the benefit of those who use PCRE2 via some other application, that is,
Packit Service 02e2fd
not writing the function calls themselves, it is possible to check the PCRE2
Packit Service 02e2fd
version by matching a pattern such as /(?(VERSION>=10)yes|no)/ against a
Packit Service 02e2fd
string such as "yesno".
Packit Service 02e2fd
Packit Service 02e2fd
5. There are case-equivalent Unicode characters whose encodings use different
Packit Service 02e2fd
numbers of code units in UTF-8. U+023A and U+2C65 are one example. (It is
Packit Service 02e2fd
theoretically possible for this to happen in UTF-16 too.) If a backreference to
Packit Service 02e2fd
a group containing one of these characters was greedily repeated, and during
Packit Service 02e2fd
the match a backtrack occurred, the subject might be backtracked by the wrong
Packit Service 02e2fd
number of code units. For example, if /^(\x{23a})\1*(.)/ is matched caselessly
Packit Service 02e2fd
(and in UTF-8 mode) against "\x{23a}\x{2c65}\x{2c65}\x{2c65}", group 2 should
Packit Service 02e2fd
capture the final character, which is the three bytes E2, B1, and A5 in UTF-8.
Packit Service 02e2fd
Incorrect backtracking meant that group 2 captured only the last two bytes.
Packit Service 02e2fd
This bug has been fixed; the new code is slower, but it is used only when the
Packit Service 02e2fd
strings matched by the repetition are not all the same length.
Packit Service 02e2fd
Packit Service 02e2fd
6. A pattern such as /()a/ was not setting the "first character must be 'a'"
Packit Service 02e2fd
information. This applied to any pattern with a group that matched no
Packit Service 02e2fd
characters, for example: /(?:(?=.)|(?
Packit Service 02e2fd
Packit Service 02e2fd
7. When an (*ACCEPT) is triggered inside capturing parentheses, it arranges for
Packit Service 02e2fd
those parentheses to be closed with whatever has been captured so far. However,
Packit Service 02e2fd
it was failing to mark any other groups between the highest capture so far and
Packit Service 02e2fd
the currrent group as "unset". Thus, the ovector for those groups contained
Packit Service 02e2fd
whatever was previously there. An example is the pattern /(x)|((*ACCEPT))/ when
Packit Service 02e2fd
matched against "abcd".
Packit Service 02e2fd
Packit Service 02e2fd
8. The pcre2_substitute() function has been implemented.
Packit Service 02e2fd
Packit Service 02e2fd
9. If an assertion used as a condition was quantified with a minimum of zero
Packit Service 02e2fd
(an odd thing to do, but it happened), SIGSEGV or other misbehaviour could
Packit Service 02e2fd
occur.
Packit Service 02e2fd
Packit Service 02e2fd
10. The PCRE2_NO_DOTSTAR_ANCHOR option has been implemented.
Packit Service 02e2fd
Packit Service 02e2fd
****