/[pcre2]/code/trunk/ChangeLog
ViewVC logotype

Contents of /code/trunk/ChangeLog

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1133 - (show annotations)
Tue Jul 16 15:06:21 2019 UTC (7 months ago) by ph10
File size: 99770 byte(s)
Fix lookbehind within lookahead within lookbehind misbehaviour bug.
1 Change Log for PCRE2
2 --------------------
3
4
5 Version 10.34 22-April-2019
6 ---------------------------
7
8 1. The maximum number of capturing subpatterns is 65535 (documented), but no
9 check on this was ever implemented. This omission has been rectified; it fixes
10 ClusterFuzz 14376.
11
12 2. Improved the invalid utf32 support of the JIT compiler. Now it correctly
13 detects invalid characters in the 0xd800-0xdfff range.
14
15 3. Fix minor typo bug in JIT compile when \X is used in a non-UTF string.
16
17 4. Add support for matching in invalid UTF strings to the pcre2_match()
18 interpreter, and integrate with the existing JIT support via the new
19 PCRE2_MATCH_INVALID_UTF compile-time option.
20
21 5. Give more error detail for invalid UTF-8 when detected in pcre2grep.
22
23 6. Add support for invalid UTF-8 to pcre2grep.
24
25 7. Adjust the limit for "must have" code unit searching, in particular,
26 increase it substantially for non-anchored patterns.
27
28 8. Allow (*ACCEPT) to be quantified, because an ungreedy quantifier with a zero
29 minimum is potentially useful.
30
31 9. Some changes to the way the minimum subject length is handled:
32
33 * When PCRE2_NO_START_OPTIMIZE is set, no minimum length is computed;
34 pcre2test now omits this item instead of showing a value of zero.
35
36 * An incorrect minimum length could be calculated for a pattern that
37 contained (*ACCEPT) inside a qualified group whose minimum repetition was
38 zero, for example /A(?:(*ACCEPT))?B/, which incorrectly computed a minimum
39 of 2. The minimum length scan no longer happens for a pattern that
40 contains (*ACCEPT).
41
42 * When no minimum length is set by the normal scan, but a first and/or last
43 code unit is recorded, set the minimum to 1 or 2 as appropriate.
44
45 * When a pattern contains multiple groups with the same number, a back
46 reference cannot know which one to scan for a minimum length. This used to
47 cause the minimum length finder to give up with no result. Now it treats
48 such references as not adding to the minimum length (which it should have
49 done all along).
50
51 * Furthermore, the above action now happens only if the back reference is to
52 a group that exists more than once in a pattern instead of any back
53 reference in a pattern with duplicate numbers.
54
55 10. A (*MARK) value inside a successful condition was not being returned by the
56 interpretive matcher (it was returned by JIT). This bug has been mended.
57
58 11. A bug in pcre2grep meant that -o without an argument (or -o0) didn't work
59 if the pattern had more than 32 capturing parentheses. This is fixed. In
60 addition (a) the default limit for groups requested by -o<n> has been raised to
61 50, (b) the new --om-capture option changes the limit, (c) an error is raised
62 if -o asks for a group that is above the limit.
63
64 12. The quantifier {1} was always being ignored, but this is incorrect when it
65 is made possessive and applied to an item in parentheses, because a
66 parenthesized item may contain multiple branches or other backtracking points,
67 for example /(a|ab){1}+c/ or /(a+){1}+a/.
68
69 13. Nested lookbehinds are now taken into account when computing the maximum
70 lookbehind value. For example /(?<=a(?<=ba)c)/ previously set a maximum
71 lookbehind of 2, because that is the largest individual lookbehind. Now it sets
72 it to 3, because matching looks back 3 characters.
73
74 14. For partial matches, pcre2test was always showing the maximum lookbehind
75 characters, flagged with "<", which is misleading when the lookbehind didn't
76 actually look behind the start (because it was later in the pattern). Showing
77 all consulted preceding characters for partial matches is now controlled by the
78 existing "allusedtext" modifier and, as for complete matches, this facility is
79 available only for non-JIT matching, because JIT does not maintain the first
80 and last consulted characters.
81
82 15. DFA matching (using pcre2_dfa_match()) was not recognising a partial match
83 if the end of the subject was encountered in a lookahead (conditional or
84 otherwise), an atomic group, or a recursion.
85
86 16. Give error if pcre2test -t, -T, -tm or -TM is given an argument of zero.
87
88 17. Check for integer overflow when computing lookbehind lengths. Fixes
89 Clusterfuzz issue 15636.
90
91 18. Implement non-atomic positive lookaround assertions.
92
93 19. If a lookbehind contained a lookahead that contained another lookbehind
94 within it, the nested lookbehind was not correctly processed. For example, if
95 /(?<=(?=(?<=a)))b/ was matched to "ab" it gave no match instead of matching
96 "b".
97
98
99 Version 10.33 16-April-2019
100 ---------------------------
101
102 1. Added "allvector" to pcre2test to make it easy to check the part of the
103 ovector that shouldn't be changed, in particular after substitute and failed or
104 partial matches.
105
106 2. Fix subject buffer overread in JIT when UTF is disabled and \X or \R has
107 a greater than 1 fixed quantifier. This issue was found by Yunho Kim.
108
109 3. Added support for callouts from pcre2_substitute(). After 10.33-RC1, but
110 prior to release, fixed a bug that caused a crash if pcre2_substitute() was
111 called with a NULL match context.
112
113 4. The POSIX functions are now all called pcre2_regcomp() etc., with wrapper
114 functions that use the standard POSIX names. However, in pcre2posix.h the POSIX
115 names are defined as macros. This should help avoid linking with the wrong
116 library in some environments while still exporting the POSIX names for
117 pre-existing programs that use them. (The Debian alternative names are also
118 defined as macros, but not documented.)
119
120 5. Fix an xclass matching issue in JIT.
121
122 6. Implement PCRE2_EXTRA_ESCAPED_CR_IS_LF (see Bugzilla 2315).
123
124 7. Implement the Perl 5.28 experimental alphabetic names for atomic groups and
125 lookaround assertions, for example, (*pla:...) and (*atomic:...). These are
126 characterized by a lower case letter following (* and to simplify coding for
127 this, the character tables created by pcre2_maketables() were updated to add a
128 new "is lower case letter" bit. At the same time, the now unused "is
129 hexadecimal digit" bit was removed. The default tables in
130 src/pcre2_chartables.c.dist are updated.
131
132 8. Implement the new Perl "script run" features (*script_run:...) and
133 (*atomic_script_run:...) aka (*sr:...) and (*asr:...).
134
135 9. Fixed two typos in change 22 for 10.21, which added special handling for
136 ranges such as a-z in EBCDIC environments. The original code probably never
137 worked, though there were no bug reports.
138
139 10. Implement PCRE2_COPY_MATCHED_SUBJECT for pcre2_match() (including JIT via
140 pcre2_match()) and pcre2_dfa_match(), but *not* the pcre2_jit_match() fast
141 path. Also, when a match fails, set the subject field in the match data to NULL
142 for tidiness - none of the substring extractors should reference this after
143 match failure.
144
145 11. If a pattern started with a subroutine call that had a quantifier with a
146 minimum of zero, an incorrect "match must start with this character" could be
147 recorded. Example: /(?&xxx)*ABC(?<xxx>XYZ)/ would (incorrectly) expect 'A' to
148 be the first character of a match.
149
150 12. The heap limit checking code in pcre2_dfa_match() could suffer from
151 overflow if the heap limit was set very large. This could cause incorrect "heap
152 limit exceeded" errors.
153
154 13. Add "kibibytes" to the heap limit output from pcre2test -C to make the
155 units clear.
156
157 14. Add a call to pcre2_jit_free_unused_memory() in pcre2grep, for tidiness.
158
159 15. Updated the VMS-specific code in pcre2test on the advice of a VMS user.
160
161 16. Removed the unnecessary inclusion of stdint.h (or inttypes.h) from
162 pcre2_internal.h as it is now included by pcre2.h. Also, change 17 for 10.32
163 below was unnecessarily complicated, as inttypes.h is a Standard C header,
164 which is defined to be a superset of stdint.h. Instead of conditionally
165 including stdint.h or inttypes.h, pcre2.h now unconditionally includes
166 inttypes.h. This supports environments that do not have stdint.h but do have
167 inttypes.h, which are known to exist. A note in the autotools documentation
168 says (November 2018) that there are none known that are the other way round.
169
170 17. Added --disable-percent-zt to "configure" (and equivalent to CMake) to
171 forcibly disable the use of %zu and %td in formatting strings because there is
172 at least one version of VMS that claims to be C99 but does not support these
173 modifiers.
174
175 18. Added --disable-pcre2grep-callout-fork, which restricts the callout support
176 in pcre2grep to the inbuilt echo facility. This may be useful in environments
177 that do not support fork().
178
179 19. Fix two instances of <= 0 being applied to unsigned integers (the VMS
180 compiler complains).
181
182 20. Added "fork" support for VMS to pcre2grep, for running an external program
183 via a string callout.
184
185 21. Improve MAP_JIT flag usage on MacOS. Patch by Rich Siegel.
186
187 22. If a pattern started with (*MARK), (*COMMIT), (*PRUNE), (*SKIP), or (*THEN)
188 followed by ^ it was not recognized as anchored.
189
190 23. The RunGrepTest script used to cut out the test of NUL characters for
191 Solaris and MacOS as printf and sed can't handle them. It seems that the *BSD
192 systems can't either. I've inverted the test so that only those OS that are
193 known to work (currently only Linux) try to run this test.
194
195 24. Some tests in RunGrepTest appended to testtrygrep from two different file
196 descriptors instead of redirecting stderr to stdout. This worked on Linux, but
197 it was reported not to on other systems, causing the tests to fail.
198
199 25. In the RunTest script, make the test for stack setting use the same value
200 for the stack as it needs for -bigstack.
201
202 26. Insert a cast in pcre2_dfa_match.c to suppress a compiler warning.
203
204 26. With PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL set, escape sequences such as \s
205 which are valid in character classes, but not as the end of ranges, were being
206 treated as literals. An example is [_-\s] (but not [\s-_] because that gave an
207 error at the *start* of a range). Now an "invalid range" error is given
208 independently of PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL.
209
210 27. Related to 26 above, PCRE2_BAD_ESCAPE_IS_LITERAL was affecting known escape
211 sequences such as \eX when they appeared invalidly in a character class. Now
212 the option applies only to unrecognized or malformed escape sequences.
213
214 28. Fix word boundary in JIT compiler. Patch by Mike Munday.
215
216 29. The pcre2_dfa_match() function was incorrectly handling conditional version
217 tests such as (?(VERSION>=0)...) when the version test was true. Incorrect
218 processing or a crash could result.
219
220 30. When PCRE2_UTF is set, allow non-ASCII letters and decimal digits in group
221 names, as Perl does. There was a small bug in this new code, found by
222 ClusterFuzz 12950, fixed before release.
223
224 31. Implemented PCRE2_EXTRA_ALT_BSUX to support ECMAScript 6's \u{hhh}
225 construct.
226
227 32. Compile \p{Any} to be the same as . in DOTALL mode, so that it benefits
228 from auto-anchoring if \p{Any}* starts a pattern.
229
230 33. Compile invalid UTF check in JIT test when only pcre32 is enabled.
231
232 34. For some time now, CMake has been warning about the setting of policy
233 CMP0026 to "OLD" in CmakeLists.txt, and hinting that the feature might be
234 removed in a future version. A request for CMake expertise on the list produced
235 no result, so I have now hacked CMakeLists.txt along the lines of some changes
236 I found on the Internet. The new code no longer needs the policy setting, and
237 it appears to work fine on Linux.
238
239 35. Setting --enable-jit=auto for an out-of-tree build failed because the
240 source directory wasn't in the search path for AC_TRY_COMPILE always. Patch
241 from Ross Burton.
242
243 36. Disable SSE2 JIT optimizations in x86 CPUs when SSE2 is not available.
244 Patch by Guillem Jover.
245
246 37. Changed expressions such as 1<<10 to 1u<<10 in many places because compiler
247 warnings were reported.
248
249 38. Using the clang compiler with sanitizing options causes runtime complaints
250 about truncation for statments such as x = ~x when x is an 8-bit value; it
251 seems to compute ~x as a 32-bit value. Changing such statements to x = 255 ^ x
252 gets rid of the warnings. There were also two missing casts in pcre2test.
253
254
255 Version 10.32 10-September-2018
256 -------------------------------
257
258 1. When matching using the the REG_STARTEND feature of the POSIX API with a
259 non-zero starting offset, unset capturing groups with lower numbers than a
260 group that did capture something were not being correctly returned as "unset"
261 (that is, with offset values of -1).
262
263 2. When matching using the POSIX API, pcre2test used to omit listing unset
264 groups altogether. Now it shows those that come before any actual captures as
265 "<unset>", as happens for non-POSIX matching.
266
267 3. Running "pcre2test -C" always stated "\R matches CR, LF, or CRLF only",
268 whatever the build configuration was. It now correctly says "\R matches all
269 Unicode newlines" in the default case when --enable-bsr-anycrlf has not been
270 specified. Similarly, running "pcre2test -C bsr" never produced the result
271 ANY.
272
273 4. Matching the pattern /(*UTF)\C[^\v]+\x80/ against an 8-bit string containing
274 multi-code-unit characters caused bad behaviour and possibly a crash. This
275 issue was fixed for other kinds of repeat in release 10.20 by change 19, but
276 repeating character classes were overlooked.
277
278 5. pcre2grep now supports the inclusion of binary zeros in patterns that are
279 read from files via the -f option.
280
281 6. A small fix to pcre2grep to avoid compiler warnings for -Wformat-overflow=2.
282
283 7. Added --enable-jit=auto support to configure.ac.
284
285 8. Added some dummy variables to the heapframe structure in 16-bit and 32-bit
286 modes for the benefit of m68k, where pointers can be 16-bit aligned. The
287 dummies force 32-bit alignment and this ensures that the structure is a
288 multiple of PCRE2_SIZE, a requirement that is tested at compile time. In other
289 architectures, alignment requirements take care of this automatically.
290
291 9. When returning an error from pcre2_pattern_convert(), ensure the error
292 offset is set zero for early errors.
293
294 10. A number of patches for Windows support from Daniel Richard G:
295
296 (a) List of error numbers in Runtest.bat corrected (it was not the same as in
297 Runtest).
298
299 (b) pcre2grep snprintf() workaround as used elsewhere in the tree.
300
301 (c) Support for non-C99 snprintf() that returns -1 in the overflow case.
302
303 11. Minor tidy of pcre2_dfa_match() code.
304
305 12. Refactored pcre2_dfa_match() so that the internal recursive calls no longer
306 use the stack for local workspace and local ovectors. Instead, an initial block
307 of stack is reserved, but if this is insufficient, heap memory is used. The
308 heap limit parameter now applies to pcre2_dfa_match().
309
310 13. If a "find limits" test of DFA matching in pcre2test resulted in too many
311 matches for the ovector, no matches were displayed.
312
313 14. Removed an occurrence of ctrl/Z from test 6 because Windows treats it as
314 EOF. The test looks to have come from a fuzzer.
315
316 15. If PCRE2 was built with a default match limit a lot greater than the
317 default default of 10 000 000, some JIT tests of the match limit no longer
318 failed. All such tests now set 10 000 000 as the upper limit.
319
320 16. Another Windows related patch for pcregrep to ensure that WIN32 is
321 undefined under Cygwin.
322
323 17. Test for the presence of stdint.h and inttypes.h in configure and CMake and
324 include whichever exists (stdint preferred) instead of unconditionally
325 including stdint. This makes life easier for old and non-standard systems.
326
327 18. Further changes to improve portability, especially to old and or non-
328 standard systems:
329
330 (a) Put all printf arguments in RunGrepTest into single, not double, quotes,
331 and use \0 not \x00 for binary zero.
332
333 (b) Avoid the use of C++ (i.e. BCPL) // comments.
334
335 (c) Parameterize the use of %zu in pcre2test to make it like %td. For both of
336 these now, if using MSVC or a standard C before C99, %lu is used with a
337 cast if necessary.
338
339 19. Applied a contributed patch to CMakeLists.txt to increase the stack size
340 when linking pcre2test with MSVC. This gets rid of a stack overflow error in
341 the standard set of tests.
342
343 20. Output a warning in pcre2test when ignoring the "altglobal" modifier when
344 it is given with the "replace" modifier.
345
346 21. In both pcre2test and pcre2_substitute(), with global matching, a pattern
347 that matched an empty string, but never at the starting match offset, was not
348 handled in a Perl-compatible way. The pattern /(<?=\G.)/ is an example of such
349 a pattern. Because \G is in a lookbehind assertion, there has to be a
350 "bumpalong" before there can be a match. The automatic "advance by one
351 character after an empty string match" rule is therefore inappropriate. A more
352 complicated algorithm has now been implemented.
353
354 22. When checking to see if a lookbehind is of fixed length, lookaheads were
355 correctly ignored, but qualifiers on lookaheads were not being ignored, leading
356 to an incorrect "lookbehind assertion is not fixed length" error.
357
358 23. The VERSION condition test was reading fractional PCRE2 version numbers
359 such as the 04 in 10.04 incorrectly and hence giving wrong results.
360
361 24. Updated to Unicode version 11.0.0. As well as the usual addition of new
362 scripts and characters, this involved re-jigging the grapheme break property
363 algorithm because Unicode has changed the way emojis are handled.
364
365 25. Fixed an obscure bug that struck when there were two atomic groups not
366 separated by something with a backtracking point. There could be an incorrect
367 backtrack into the first of the atomic groups. A complicated example is
368 /(?>a(*:1))(?>b)(*SKIP:1)x|.*/ matched against "abc", where the *SKIP
369 shouldn't find a MARK (because is in an atomic group), but it did.
370
371 26. Upgraded the perltest.sh script: (1) #pattern lines can now be used to set
372 a list of modifiers for all subsequent patterns - only those that the script
373 recognizes are meaningful; (2) #subject lines can be used to set or unset a
374 default "mark" modifier; (3) Unsupported #command lines give a warning when
375 they are ignored; (4) Mark data is output only if the "mark" modifier is
376 present.
377
378 27. (*ACCEPT:ARG), (*FAIL:ARG), and (*COMMIT:ARG) are now supported.
379
380 28. A (*MARK) name was not being passed back for positive assertions that were
381 terminated by (*ACCEPT).
382
383 29. Add support for \N{U+dddd}, but only in Unicode mode.
384
385 30. Add support for (?^) for unsetting all imnsx options.
386
387 31. The PCRE2_EXTENDED (/x) option only ever discarded space characters whose
388 code point was less than 256 and that were recognized by the lookup table
389 generated by pcre2_maketables(), which uses isspace() to identify white space.
390 Now, when Unicode support is compiled, PCRE2_EXTENDED also discards U+0085,
391 U+200E, U+200F, U+2028, and U+2029, which are additional characters defined by
392 Unicode as "Pattern White Space". This makes PCRE2 compatible with Perl.
393
394 32. In certain circumstances, option settings within patterns were not being
395 correctly processed. For example, the pattern /((?i)A)(?m)B/ incorrectly
396 matched "ab". (The (?m) setting lost the fact that (?i) should be reset at the
397 end of its group during the parse process, but without another setting such as
398 (?m) the compile phase got it right.) This bug was introduced by the
399 refactoring in release 10.23.
400
401 33. PCRE2 uses bcopy() if available when memmove() is not, and it used just to
402 define memmove() as function call to bcopy(). This hasn't been tested for a
403 long time because in pcre2test the result of memmove() was being used, whereas
404 bcopy() doesn't return a result. This feature is now refactored always to call
405 an emulation function when there is no memmove(). The emulation makes use of
406 bcopy() when available.
407
408 34. When serializing a pattern, set the memctl, executable_jit, and tables
409 fields (that is, all the fields that contain pointers) to zeros so that the
410 result of serializing is always the same. These fields are re-set when the
411 pattern is deserialized.
412
413 35. In a pattern such as /[^\x{100}-\x{ffff}]*[\x80-\xff]/ which has a repeated
414 negative class with no characters less than 0x100 followed by a positive class
415 with only characters less than 0x100, the first class was incorrectly being
416 auto-possessified, causing incorrect match failures.
417
418 36. Removed the character type bit ctype_meta, which dates from PCRE1 and is
419 not used in PCRE2.
420
421 37. Tidied up unnecessarily complicated macros used in the escapes table.
422
423 38. Since 10.21, the new testoutput8-16-4 file has accidentally been omitted
424 from distribution tarballs, owing to a typo in Makefile.am which had
425 testoutput8-16-3 twice. Now fixed.
426
427 39. If the only branch in a conditional subpattern was anchored, the whole
428 subpattern was treated as anchored, when it should not have been, since the
429 assumed empty second branch cannot be anchored. Demonstrated by test patterns
430 such as /(?(1)^())b/ or /(?(?=^))b/.
431
432 40. A repeated conditional subpattern that could match an empty string was
433 always assumed to be unanchored. Now it it checked just like any other
434 repeated conditional subpattern, and can be found to be anchored if the minimum
435 quantifier is one or more. I can't see much use for a repeated anchored
436 pattern, but the behaviour is now consistent.
437
438 41. Minor addition to pcre2_jit_compile.c to avoid static analyzer complaint
439 (for an event that could never occur but you had to have external information
440 to know that).
441
442 42. If before the first match in a file that was being searched by pcre2grep
443 there was a line that was sufficiently long to cause the input buffer to be
444 expanded, the variable holding the location of the end of the previous match
445 was being adjusted incorrectly, and could cause an overflow warning from a code
446 sanitizer. However, as the value is used only to print pending "after" lines
447 when the next match is reached (and there are no such lines in this case) this
448 bug could do no damage.
449
450
451 Version 10.31 12-February-2018
452 ------------------------------
453
454 1. Fix typo (missing ]) in VMS code in pcre2test.c.
455
456 2. Replace the replicated code for matching extended Unicode grapheme sequences
457 (which got a lot more complicated by change 10.30/49) by a single subroutine
458 that is called by both pcre2_match() and pcre2_dfa_match().
459
460 3. Add idempotent guard to pcre2_internal.h.
461
462 4. Add new pcre2_config() options: PCRE2_CONFIG_NEVER_BACKSLASH_C and
463 PCRE2_CONFIG_COMPILED_WIDTHS.
464
465 5. Cut out \C tests in the JIT regression tests when NEVER_BACKSLASH_C is
466 defined (e.g. by --enable-never-backslash-C).
467
468 6. Defined public names for all the pcre2_compile() error numbers, and used
469 the public names in pcre2_convert.c.
470
471 7. Fixed a small memory leak in pcre2test (convert contexts).
472
473 8. Added two casts to compile.c and one to match.c to avoid compiler warnings.
474
475 9. Added code to pcre2grep when compiled under VMS to set the symbol
476 PCRE2GREP_RC to the exit status, because VMS does not distinguish between
477 exit(0) and exit(1).
478
479 10. Added the -LM (list modifiers) option to pcre2test. Also made -C complain
480 about a bad option only if the following argument item does not start with a
481 hyphen.
482
483 11. pcre2grep was truncating components of file names to 128 characters when
484 processing files with the -r option, and also (some very odd code) truncating
485 path names to 512 characters. There is now a check on the absolute length of
486 full path file names, which may be up to 2047 characters long.
487
488 12. When an assertion contained (*ACCEPT) it caused all open capturing groups
489 to be closed (as for a non-assertion ACCEPT), which was wrong and could lead to
490 misbehaviour for subsequent references to groups that started outside the
491 assertion. ACCEPT in an assertion now closes only those groups that were
492 started within that assertion. Fixes oss-fuzz issues 3852 and 3891.
493
494 13. Multiline matching in pcre2grep was misbehaving if the pattern matched
495 within a line, and then matched again at the end of the line and over into
496 subsequent lines. Behaviour was different with and without colouring, and
497 sometimes context lines were incorrectly printed and/or line endings were lost.
498 All these issues should now be fixed.
499
500 14. If --line-buffered was specified for pcre2grep when input was from a
501 compressed file (.gz or .bz2) a segfault occurred. (Line buffering should be
502 ignored for compressed files.)
503
504 15. Although pcre2_jit_match checks whether the pattern is compiled
505 in a given mode, it was also expected that at least one mode is available.
506 This is fixed and pcre2_jit_match returns with PCRE2_ERROR_JIT_BADOPTION
507 when the pattern is not optimized by JIT at all.
508
509 16. The line number and related variables such as match counts in pcre2grep
510 were all int variables, causing overflow when files with more than 2147483647
511 lines were processed (assuming 32-bit ints). They have all been changed to
512 unsigned long ints.
513
514 17. If a backreference with a minimum repeat count of zero was first in a
515 pattern, apart from assertions, an incorrect first matching character could be
516 recorded. For example, for the pattern /(?=(a))\1?b/, "b" was incorrectly set
517 as the first character of a match.
518
519 18. Characters in a leading positive assertion are considered for recording a
520 first character of a match when the rest of the pattern does not provide one.
521 However, a character in a non-assertive group within a leading assertion such
522 as in the pattern /(?=(a))\1?b/ caused this process to fail. This was an
523 infelicity rather than an outright bug, because it did not affect the result of
524 a match, just its speed. (In fact, in this case, the starting 'a' was
525 subsequently picked up in the study.)
526
527 19. A minor tidy in pcre2_match(): making all PCRE2_ERROR_ returns use "return"
528 instead of "RRETURN" saves unwinding the backtracks in these cases (only one
529 didn't).
530
531 20. Allocate a single callout block on the stack at the start of pcre2_match()
532 and set its never-changing fields once only. Do the same for pcre2_dfa_match().
533
534 21. Save the extra compile options (set in the compile context) with the
535 compiled pattern (they were not previously saved), add PCRE2_INFO_EXTRAOPTIONS
536 to retrieve them, and update pcre2test to show them.
537
538 22. Added PCRE2_CALLOUT_STARTMATCH and PCRE2_CALLOUT_BACKTRACK bits to a new
539 field callout_flags in callout blocks. The bits are set by pcre2_match(), but
540 not by JIT or pcre2_dfa_match(). Their settings are shown in pcre2test callouts
541 if the callout_extra subject modifier is set. These bits are provided to help
542 with tracking how a backtracking match is proceeding.
543
544 23. Updated the pcre2demo.c demonstration program, which was missing the extra
545 code for -g that handles the case when \K in an assertion causes the match to
546 end at the original start point. Also arranged for it to detect when \K causes
547 the end of a match to be before its start.
548
549 24. Similar to 23 above, strange things (including loops) could happen in
550 pcre2grep when \K was used in an assertion when --colour was used or in
551 multiline mode. The "end at original start point" bug is fixed, and if the end
552 point is found to be before the start point, they are swapped.
553
554 25. When PCRE2_FIRSTLINE without PCRE2_NO_START_OPTIMIZE was used in non-JIT
555 matching (both pcre2_match() and pcre2_dfa_match()) and the matched string
556 started with the first code unit of a newline sequence, matching failed because
557 it was not tried at the newline.
558
559 26. Code for giving up a non-partial match after failing to find a starting
560 code unit anywhere in the subject was missing when searching for one of a
561 number of code units (the bitmap case) in both pcre2_match() and
562 pcre2_dfa_match(). This was a missing optimization rather than a bug.
563
564 27. Tidied up the ACROSSCHAR macro to be like FORWARDCHAR and BACKCHAR, using a
565 pointer argument rather than a code unit value. This should not have affected
566 the generated code.
567
568 28. The JIT compiler has been updated.
569
570 29. Avoid pointer overflow for unset captures in pcre2_substring_list_get().
571 This could not actually cause a crash because it was always used in a memcpy()
572 call with zero length.
573
574 30. Some internal structures have a variable-length ovector[] as their last
575 element. Their actual memory is obtained dynamically, giving an ovector of
576 appropriate length. However, they are defined in the structure as
577 ovector[NUMBER], where NUMBER is large so that array bound checkers don't
578 grumble. The value of NUMBER was 10000, but a fuzzer exceeded 5000 capturing
579 groups, making the ovector larger than this. The number has been increased to
580 131072, which allows for the maximum number of captures (65535) plus the
581 overall match. This fixes oss-fuzz issue 5415.
582
583 31. Auto-possessification at the end of a capturing group was dependent on what
584 follows the group (e.g. /(a+)b/ would auto-possessify the a+) but this caused
585 incorrect behaviour when the group was called recursively from elsewhere in the
586 pattern where something different might follow. This bug is an unforseen
587 consequence of change #1 for 10.30 - the implementation of backtracking into
588 recursions. Iterators at the ends of capturing groups are no longer considered
589 for auto-possessification if the pattern contains any recursions. Fixes
590 Bugzilla #2232.
591
592
593 Version 10.30 14-August-2017
594 ----------------------------
595
596 1. The main interpreter, pcre2_match(), has been refactored into a new version
597 that does not use recursive function calls (and therefore the stack) for
598 remembering backtracking positions. This makes --disable-stack-for-recursion a
599 NOOP. The new implementation allows backtracking into recursive group calls in
600 patterns, making it more compatible with Perl, and also fixes some other
601 hard-to-do issues such as #1887 in Bugzilla. The code is also cleaner because
602 the old code had a number of fudges to try to reduce stack usage. It seems to
603 run no slower than the old code.
604
605 A number of bugs in the refactored code were subsequently fixed during testing
606 before release, but after the code was made available in the repository. These
607 bugs were never in fully released code, but are noted here for the record.
608
609 (a) If a pattern had fewer capturing parentheses than the ovector supplied in
610 the match data block, a memory error (detectable by ASAN) occurred after
611 a match, because the external block was being set from non-existent
612 internal ovector fields. Fixes oss-fuzz issue 781.
613
614 (b) A pattern with very many capturing parentheses (when the internal frame
615 size was greater than the initial frame vector on the stack) caused a
616 crash. A vector on the heap is now set up at the start of matching if the
617 vector on the stack is not big enough to handle at least 10 frames.
618 Fixes oss-fuzz issue 783.
619
620 (c) Handling of (*VERB)s in recursions was wrong in some cases.
621
622 (d) Captures in negative assertions that were used as conditions were not
623 happening if the assertion matched via (*ACCEPT).
624
625 (e) Mark values were not being passed out of recursions.
626
627 (f) Refactor some code in do_callout() to avoid picky compiler warnings about
628 negative indices. Fixes oss-fuzz issue 1454.
629
630 (g) Similarly refactor the way the variable length ovector is addressed for
631 similar reasons. Fixes oss-fuzz issue 1465.
632
633 2. Now that pcre2_match() no longer uses recursive function calls (see above),
634 the "match limit recursion" value seems misnamed. It still exists, and limits
635 the depth of tree that is searched. To avoid future confusion, it has been
636 renamed as "depth limit" in all relevant places (--with-depth-limit,
637 (*LIMIT_DEPTH), pcre2_set_depth_limit(), etc) but the old names are still
638 available for backwards compatibility.
639
640 3. Hardened pcre2test so as to reduce the number of bugs reported by fuzzers:
641
642 (a) Check for malloc failures when getting memory for the ovector (POSIX) or
643 the match data block (non-POSIX).
644
645 4. In the 32-bit library in non-UTF mode, an attempt to find a Unicode property
646 for a character with a code point greater than 0x10ffff (the Unicode maximum)
647 caused a crash.
648
649 5. If a lookbehind assertion that contained a back reference to a group
650 appearing later in the pattern was compiled with the PCRE2_ANCHORED option,
651 undefined actions (often a segmentation fault) could occur, depending on what
652 other options were set. An example assertion is (?<!\1(abc)) where the
653 reference \1 precedes the group (abc). This fixes oss-fuzz issue 865.
654
655 6. Added the PCRE2_INFO_FRAMESIZE item to pcre2_pattern_info() and arranged for
656 pcre2test to use it to output the frame size when the "framesize" modifier is
657 given.
658
659 7. Reworked the recursive pattern matching in the JIT compiler to follow the
660 interpreter changes.
661
662 8. When the zero_terminate modifier was specified on a pcre2test subject line
663 for global matching, unpredictable things could happen. For example, in UTF-8
664 mode, the pattern //g,zero_terminate read random memory when matched against an
665 empty string with zero_terminate. This was a bug in pcre2test, not the library.
666
667 9. Moved some Windows-specific code in pcre2grep (introduced in 10.23/13) out
668 of the section that is compiled when Unix-style directory scanning is
669 available, and into a new section that is always compiled for Windows.
670
671 10. In pcre2test, explicitly close the file after an error during serialization
672 or deserialization (the "load" or "save" commands).
673
674 11. Fix memory leak in pcre2_serialize_decode() when the input is invalid.
675
676 12. Fix potential NULL dereference in pcre2_callout_enumerate() if called with
677 a NULL pattern pointer when Unicode support is available.
678
679 13. When the 32-bit library was being tested by pcre2test, error messages that
680 were longer than 64 code units could cause a buffer overflow. This was a bug in
681 pcre2test.
682
683 14. The alternative matching function, pcre2_dfa_match() misbehaved if it
684 encountered a character class with a possessive repeat, for example [a-f]{3}+.
685
686 15. The depth (formerly recursion) limit now applies to DFA matching (as
687 of 10.23/36); pcre2test has been upgraded so that \=find_limits works with DFA
688 matching to find the minimum value for this limit.
689
690 16. Since 10.21, if pcre2_match() was called with a null context, default
691 memory allocation functions were used instead of whatever was used when the
692 pattern was compiled.
693
694 17. Changes to the pcre2test "memory" modifier on a subject line. These apply
695 only to pcre2_match():
696
697 (a) Warn if null_context is set on both pattern and subject, because the
698 memory details cannot then be shown.
699
700 (b) Remember (up to a certain number of) memory allocations and their
701 lengths, and list only the lengths, so as to be system-independent.
702 (In practice, the new interpreter never has more than 2 blocks allocated
703 simultaneously.)
704
705 18. Make pcre2test detect an error return from pcre2_get_error_message(), give
706 a message, and abandon the run (this would have detected #13 above).
707
708 19. Implemented PCRE2_ENDANCHORED.
709
710 20. Applied Jason Hood's patches (slightly modified) to pcre2grep, to implement
711 the --output=text (-O) option and the inbuilt callout echo.
712
713 21. Extend auto-anchoring etc. to ignore groups with a zero qualifier and
714 single-branch conditions with a false condition (e.g. DEFINE) at the start of a
715 branch. For example, /(?(DEFINE)...)^A/ and /(...){0}^B/ are now flagged as
716 anchored.
717
718 22. Added an explicit limit on the amount of heap used by pcre2_match(), set by
719 pcre2_set_heap_limit() or (*LIMIT_HEAP=xxx). Upgraded pcre2test to show the
720 heap limit along with other pattern information, and to find the minimum when
721 the find_limits modifier is set.
722
723 23. Write to the last 8 bytes of the pcre2_real_code structure when a compiled
724 pattern is set up so as to initialize any padding the compiler might have
725 included. This avoids valgrind warnings when a compiled pattern is copied, in
726 particular when it is serialized.
727
728 24. Remove a redundant line of code left in accidentally a long time ago.
729
730 25. Remove a duplication typo in pcre2_tables.c
731
732 26. Correct an incorrect cast in pcre2_valid_utf.c
733
734 27. Update pcre2test, remove some unused code in pcre2_match(), and upgrade the
735 tests to improve coverage.
736
737 28. Some fixes/tidies as a result of looking at Coverity Scan output:
738
739 (a) Typo: ">" should be ">=" in opcode check in pcre2_auto_possess.c.
740 (b) Added some casts to avoid "suspicious implicit sign extension".
741 (c) Resource leaks in pcre2test in rare error cases.
742 (d) Avoid warning for never-use case OP_TABLE_LENGTH which is just a fudge
743 for checking at compile time that tables are the right size.
744 (e) Add missing "fall through" comment.
745
746 29. Implemented PCRE2_EXTENDED_MORE and related /xx and (?xx) features.
747
748 30. Implement (?n: for PCRE2_NO_AUTO_CAPTURE, because Perl now has this.
749
750 31. If more than one of "push", "pushcopy", or "pushtablescopy" were set in
751 pcre2test, a crash could occur.
752
753 32. Make -bigstack in RunTest allocate a 64MiB stack (instead of 16MiB) so
754 that all the tests can run with clang's sanitizing options.
755
756 33. Implement extra compile options in the compile context and add the first
757 one: PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES.
758
759 34. Implement newline type PCRE2_NEWLINE_NUL.
760
761 35. A lookbehind assertion that had a zero-length branch caused undefined
762 behaviour when processed by pcre2_dfa_match(). This is oss-fuzz issue 1859.
763
764 36. The match limit value now also applies to pcre2_dfa_match() as there are
765 patterns that can use up a lot of resources without necessarily recursing very
766 deeply. (Compare item 10.23/36.) This should fix oss-fuzz #1761.
767
768 37. Implement PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL.
769
770 38. Fix returned offsets from regexec() when REG_STARTEND is used with a
771 starting offset greater than zero.
772
773 39. Implement REG_PEND (GNU extension) for the POSIX wrapper.
774
775 40. Implement the subject_literal modifier in pcre2test, and allow jitstack on
776 pattern lines.
777
778 41. Implement PCRE2_LITERAL and use it to support REG_NOSPEC.
779
780 42. Implement PCRE2_EXTRA_MATCH_LINE and PCRE2_EXTRA_MATCH_WORD for the benefit
781 of pcre2grep.
782
783 43. Re-implement pcre2grep's -F, -w, and -x options using PCRE2_LITERAL,
784 PCRE2_EXTRA_MATCH_WORD, and PCRE2_EXTRA_MATCH_LINE. This fixes two bugs:
785
786 (a) The -F option did not work for fixed strings containing \E.
787 (b) The -w option did not work for patterns with multiple branches.
788
789 44. Added configuration options for the SELinux compatible execmem allocator in
790 JIT.
791
792 45. Increased the limit for searching for a "must be present" code unit in
793 subjects from 1000 to 2000 for 8-bit searches, since they use memchr() and are
794 much faster.
795
796 46. Arrange for anchored patterns to record and use "first code unit" data,
797 because this can give a fast "no match" without searching for a "required code
798 unit". Previously only non-anchored patterns did this.
799
800 47. Upgraded the Unicode tables from Unicode 8.0.0 to Unicode 10.0.0.
801
802 48. Add the callout_no_where modifier to pcre2test.
803
804 49. Update extended grapheme breaking rules to the latest set that are in
805 Unicode Standard Annex #29.
806
807 50. Added experimental foreign pattern conversion facilities
808 (pcre2_pattern_convert() and friends).
809
810 51. Change the macro FWRITE, used in pcre2grep, to FWRITE_IGNORE because FWRITE
811 is defined in a system header in cygwin. Also modified some of the #ifdefs in
812 pcre2grep related to Windows and Cygwin support.
813
814 52. Change 3(g) for 10.23 was a bit too zealous. If a hyphen that follows a
815 character class is the last character in the class, Perl does not give a
816 warning. PCRE2 now also treats this as a literal.
817
818 53. Related to 52, though PCRE2 was throwing an error for [[:digit:]-X] it was
819 not doing so for [\d-X] (and similar escapes), as is documented.
820
821 54. Fixed a MIPS issue in the JIT compiler reported by Joshua Kinard.
822
823 55. Fixed a "maybe uninitialized" warning for class_uchardata in \p handling in
824 pcre2_compile() which could never actually trigger (code should have been cut
825 out when Unicode support is disabled).
826
827
828 Version 10.23 14-February-2017
829 ------------------------------
830
831 1. Extended pcre2test with the utf8_input modifier so that it is able to
832 generate all possible 16-bit and 32-bit code unit values in non-UTF modes.
833
834 2. In any wide-character mode (8-bit UTF or any 16-bit or 32-bit mode), without
835 PCRE2_UCP set, a negative character type such as \D in a positive class should
836 cause all characters greater than 255 to match, whatever else is in the class.
837 There was a bug that caused this not to happen if a Unicode property item was
838 added to such a class, for example [\D\P{Nd}] or [\W\pL].
839
840 3. There has been a major re-factoring of the pcre2_compile.c file. Most syntax
841 checking is now done in the pre-pass that identifies capturing groups. This has
842 reduced the amount of duplication and made the code tidier. While doing this,
843 some minor bugs and Perl incompatibilities were fixed, including:
844
845 (a) \Q\E in the middle of a quantifier such as A+\Q\E+ is now ignored instead
846 of giving an invalid quantifier error.
847
848 (b) {0} can now be used after a group in a lookbehind assertion; previously
849 this caused an "assertion is not fixed length" error.
850
851 (c) Perl always treats (?(DEFINE) as a "define" group, even if a group with
852 the name "DEFINE" exists. PCRE2 now does likewise.
853
854 (d) A recursion condition test such as (?(R2)...) must now refer to an
855 existing subpattern.
856
857 (e) A conditional recursion test such as (?(R)...) misbehaved if there was a
858 group whose name began with "R".
859
860 (f) When testing zero-terminated patterns under valgrind, the terminating
861 zero is now marked "no access". This catches bugs that would otherwise
862 show up only with non-zero-terminated patterns.
863
864 (g) A hyphen appearing immediately after a POSIX character class (for example
865 /[[:ascii:]-z]/) now generates an error. Perl does accept this as a
866 literal, but gives a warning, so it seems best to fail it in PCRE.
867
868 (h) An empty \Q\E sequence may appear after a callout that precedes an
869 assertion condition (it is, of course, ignored).
870
871 One effect of the refactoring is that some error numbers and messages have
872 changed, and the pattern offset given for compiling errors is not always the
873 right-most character that has been read. In particular, for a variable-length
874 lookbehind assertion it now points to the start of the assertion. Another
875 change is that when a callout appears before a group, the "length of next
876 pattern item" that is passed now just gives the length of the opening
877 parenthesis item, not the length of the whole group. A length of zero is now
878 given only for a callout at the end of the pattern. Automatic callouts are no
879 longer inserted before and after explicit callouts in the pattern.
880
881 A number of bugs in the refactored code were subsequently fixed during testing
882 before release, but after the code was made available in the repository. Many
883 of the bugs were discovered by fuzzing testing. Several of them were related to
884 the change from assuming a zero-terminated pattern (which previously had
885 required non-zero terminated strings to be copied). These bugs were never in
886 fully released code, but are noted here for the record.
887
888 (a) An overall recursion such as (?0) inside a lookbehind assertion was not
889 being diagnosed as an error.
890
891 (b) In utf mode, the length of a *MARK (or other verb) name was being checked
892 in characters instead of code units, which could lead to bad code being
893 compiled, leading to unpredictable behaviour.
894
895 (c) In extended /x mode, characters whose code was greater than 255 caused
896 a lookup outside one of the global tables. A similar bug existed for wide
897 characters in *VERB names.
898
899 (d) The amount of memory needed for a compiled pattern was miscalculated if a
900 lookbehind contained more than one toplevel branch and the first branch
901 was of length zero.
902
903 (e) In UTF-8 or UTF-16 modes with PCRE2_EXTENDED (/x) set and a non-zero-
904 terminated pattern, if a # comment ran on to the end of the pattern, one
905 or more code units past the end were being read.
906
907 (f) An unterminated repeat at the end of a non-zero-terminated pattern (e.g.
908 "{2,2") could cause reading beyond the pattern.
909
910 (g) When reading a callout string, if the end delimiter was at the end of the
911 pattern one further code unit was read.
912
913 (h) An unterminated number after \g' could cause reading beyond the pattern.
914
915 (i) An insufficient memory size was being computed for compiling with
916 PCRE2_AUTO_CALLOUT.
917
918 (j) A conditional group with an assertion condition used more memory than was
919 allowed for it during parsing, so too many of them could therefore
920 overrun a buffer.
921
922 (k) If parsing a pattern exactly filled the buffer, the internal test for
923 overrun did not check when the final META_END item was added.
924
925 (l) If a lookbehind contained a subroutine call, and the called group
926 contained an option setting such as (?s), and the PCRE2_ANCHORED option
927 was set, unpredictable behaviour could occur. The underlying bug was
928 incorrect code and insufficient checking while searching for the end of
929 the called subroutine in the parsed pattern.
930
931 (m) Quantifiers following (*VERB)s were not being diagnosed as errors.
932
933 (n) The use of \Q...\E in a (*VERB) name when PCRE2_ALT_VERBNAMES and
934 PCRE2_AUTO_CALLOUT were both specified caused undetermined behaviour.
935
936 (o) If \Q was preceded by a quantified item, and the following \E was
937 followed by '?' or '+', and there was at least one literal character
938 between them, an internal error "unexpected repeat" occurred (example:
939 /.+\QX\E+/).
940
941 (p) A buffer overflow could occur while sorting the names in the group name
942 list (depending on the order in which the names were seen).
943
944 (q) A conditional group that started with a callout was not doing the right
945 check for a following assertion, leading to compiling bad code. Example:
946 /(?(C'XX))?!XX/
947
948 (r) If a character whose code point was greater than 0xffff appeared within
949 a lookbehind that was within another lookbehind, the calculation of the
950 lookbehind length went wrong and could provoke an internal error.
951
952 (t) The sequence \E- or \Q\E- after a POSIX class in a character class caused
953 an internal error. Now the hyphen is treated as a literal.
954
955 4. Back references are now permitted in lookbehind assertions when there are
956 no duplicated group numbers (that is, (?| has not been used), and, if the
957 reference is by name, there is only one group of that name. The referenced
958 group must, of course be of fixed length.
959
960 5. pcre2test has been upgraded so that, when run under valgrind with valgrind
961 support enabled, reading past the end of the pattern is detected, both when
962 compiling and during callout processing.
963
964 6. \g{+<number>} (e.g. \g{+2} ) is now supported. It is a "forward back
965 reference" and can be useful in repetitions (compare \g{-<number>} ). Perl does
966 not recognize this syntax.
967
968 7. Automatic callouts are no longer generated before and after callouts in the
969 pattern.
970
971 8. When pcre2test was outputing information from a callout, the caret indicator
972 for the current position in the subject line was incorrect if it was after an
973 escape sequence for a character whose code point was greater than \x{ff}.
974
975 9. Change 19 for 10.22 had a typo (PCRE_STATIC_RUNTIME should be
976 PCRE2_STATIC_RUNTIME). Fix from David Gaussmann.
977
978 10. Added --max-buffer-size to pcre2grep, to allow for automatic buffer
979 expansion when long lines are encountered. Original patch by Dmitry
980 Cherniachenko.
981
982 11. If pcre2grep was compiled with JIT support, but the library was compiled
983 without it (something that neither ./configure nor CMake allow, but it can be
984 done by editing config.h), pcre2grep was giving a JIT error. Now it detects
985 this situation and does not try to use JIT.
986
987 12. Added some "const" qualifiers to variables in pcre2grep.
988
989 13. Added Dmitry Cherniachenko's patch for colouring output in Windows
990 (untested by me). Also, look for GREP_COLOUR or GREP_COLOR if the environment
991 variables PCRE2GREP_COLOUR and PCRE2GREP_COLOR are not found.
992
993 14. Add the -t (grand total) option to pcre2grep.
994
995 15. A number of bugs have been mended relating to match start-up optimizations
996 when the first thing in a pattern is a positive lookahead. These all applied
997 only when PCRE2_NO_START_OPTIMIZE was *not* set:
998
999 (a) A pattern such as (?=.*X)X$ was incorrectly optimized as if it needed
1000 both an initial 'X' and a following 'X'.
1001 (b) Some patterns starting with an assertion that started with .* were
1002 incorrectly optimized as having to match at the start of the subject or
1003 after a newline. There are cases where this is not true, for example,
1004 (?=.*[A-Z])(?=.{8,16})(?!.*[\s]) matches after the start in lines that
1005 start with spaces. Starting .* in an assertion is no longer taken as an
1006 indication of matching at the start (or after a newline).
1007
1008 16. The "offset" modifier in pcre2test was not being ignored (as documented)
1009 when the POSIX API was in use.
1010
1011 17. Added --enable-fuzz-support to "configure", causing an non-installed
1012 library containing a test function that can be called by fuzzers to be
1013 compiled. A non-installed binary to run the test function locally, called
1014 pcre2fuzzcheck is also compiled.
1015
1016 18. A pattern with PCRE2_DOTALL (/s) set but not PCRE2_NO_DOTSTAR_ANCHOR, and
1017 which started with .* inside a positive lookahead was incorrectly being
1018 compiled as implicitly anchored.
1019
1020 19. Removed all instances of "register" declarations, as they are considered
1021 obsolete these days and in any case had become very haphazard.
1022
1023 20. Add strerror() to pcre2test for failed file opening.
1024
1025 21. Make pcre2test -C list valgrind support when it is enabled.
1026
1027 22. Add the use_length modifier to pcre2test.
1028
1029 23. Fix an off-by-one bug in pcre2test for the list of names for 'get' and
1030 'copy' modifiers.
1031
1032 24. Add PCRE2_CALL_CONVENTION into the prototype declarations in pcre2.h as it
1033 is apparently needed there as well as in the function definitions. (Why did
1034 nobody ask for this in PCRE1?)
1035
1036 25. Change the _PCRE2_H and _PCRE2_UCP_H guard macros in the header files to
1037 PCRE2_H_IDEMPOTENT_GUARD and PCRE2_UCP_H_IDEMPOTENT_GUARD to be more standard
1038 compliant and unique.
1039
1040 26. pcre2-config --libs-posix was listing -lpcre2posix instead of
1041 -lpcre2-posix. Also, the CMake build process was building the library with the
1042 wrong name.
1043
1044 27. In pcre2test, give some offset information for errors in hex patterns.
1045 This uses the C99 formatting sequence %td, except for MSVC which doesn't
1046 support it - %lu is used instead.
1047
1048 28. Implemented pcre2_code_copy_with_tables(), and added pushtablescopy to
1049 pcre2test for testing it.
1050
1051 29. Fix small memory leak in pcre2test.
1052
1053 30. Fix out-of-bounds read for partial matching of /./ against an empty string
1054 when the newline type is CRLF.
1055
1056 31. Fix a bug in pcre2test that caused a crash when a locale was set either in
1057 the current pattern or a previous one and a wide character was matched.
1058
1059 32. The appearance of \p, \P, or \X in a substitution string when
1060 PCRE2_SUBSTITUTE_EXTENDED was set caused a segmentation fault (NULL
1061 dereference).
1062
1063 33. If the starting offset was specified as greater than the subject length in
1064 a call to pcre2_substitute() an out-of-bounds memory reference could occur.
1065
1066 34. When PCRE2 was compiled to use the heap instead of the stack for recursive
1067 calls to match(), a repeated minimizing caseless back reference, or a
1068 maximizing one where the two cases had different numbers of code units,
1069 followed by a caseful back reference, could lose the caselessness of the first
1070 repeated back reference (example: /(Z)(a)\2{1,2}?(?-i)\1X/i should match ZaAAZX
1071 but didn't).
1072
1073 35. When a pattern is too complicated, PCRE2 gives up trying to find a minimum
1074 matching length and just records zero. Typically this happens when there are
1075 too many nested or recursive back references. If the limit was reached in
1076 certain recursive cases it failed to be triggered and an internal error could
1077 be the result.
1078
1079 36. The pcre2_dfa_match() function now takes note of the recursion limit for
1080 the internal recursive calls that are used for lookrounds and recursions within
1081 the pattern.
1082
1083 37. More refactoring has got rid of the internal could_be_empty_branch()
1084 function (around 400 lines of code, including comments) by keeping track of
1085 could-be-emptiness as the pattern is compiled instead of scanning compiled
1086 groups. (This would have been much harder before the refactoring of #3 above.)
1087 This lifts a restriction on the number of branches in a group (more than about
1088 1100 would give "pattern is too complicated").
1089
1090 38. Add the "-ac" command line option to pcre2test as a synonym for "-pattern
1091 auto_callout".
1092
1093 39. In a library with Unicode support, incorrect data was compiled for a
1094 pattern with PCRE2_UCP set without PCRE2_UTF if a class required all wide
1095 characters to match (for example, /[\s[:^ascii:]]/).
1096
1097 40. The callout_error modifier has been added to pcre2test to make it possible
1098 to return PCRE2_ERROR_CALLOUT from a callout.
1099
1100 41. A minor change to pcre2grep: colour reset is now "<esc>[0m" instead of
1101 "<esc>[00m".
1102
1103 42. The limit in the auto-possessification code that was intended to catch
1104 overly-complicated patterns and not spend too much time auto-possessifying was
1105 being reset too often, resulting in very long compile times for some patterns.
1106 Now such patterns are no longer completely auto-possessified.
1107
1108 43. Applied Jason Hood's revised patch for RunTest.bat.
1109
1110 44. Added a new Windows script RunGrepTest.bat, courtesy of Jason Hood.
1111
1112 45. Minor cosmetic fix to pcre2test: move a variable that is not used under
1113 Windows into the "not Windows" code.
1114
1115 46. Applied Jason Hood's patches to upgrade pcre2grep under Windows and tidy
1116 some of the code:
1117
1118 * normalised the Windows condition by ensuring WIN32 is defined;
1119 * enables the callout feature under Windows;
1120 * adds globbing (Microsoft's implementation expands quoted args),
1121 using a tweaked opendirectory;
1122 * implements the is_*_tty functions for Windows;
1123 * --color=always will write the ANSI sequences to file;
1124 * add sequences 4 (underline works on Win10) and 5 (blink as bright
1125 background, relatively standard on DOS/Win);
1126 * remove the (char *) casts for the now-const strings;
1127 * remove GREP_COLOUR (grep's command line allowed the 'u', but not
1128 the environment), parsing GREP_COLORS instead;
1129 * uses the current colour if not set, rather than black;
1130 * add print_match for the undefined case;
1131 * fixes a typo.
1132
1133 In addition, colour settings containing anything other than digits and
1134 semicolon are ignored, and the colour controls are no longer output for empty
1135 strings.
1136
1137 47. Detecting patterns that are too large inside the length-measuring loop
1138 saves processing ridiculously long patterns to their end.
1139
1140 48. Ignore PCRE2_CASELESS when processing \h, \H, \v, and \V in classes as it
1141 just wastes time. In the UTF case it can also produce redundant entries in
1142 XCLASS lists caused by characters with multiple other cases and pairs of
1143 characters in the same "not-x" sublists.
1144
1145 49. A pattern such as /(?=(a\K))/ can report the end of the match being before
1146 its start; pcre2test was not handling this correctly when using the POSIX
1147 interface (it was OK with the native interface).
1148
1149 50. In pcre2grep, ignore all JIT compile errors. This means that pcre2grep will
1150 continue to work, falling back to interpretation if anything goes wrong with
1151 JIT.
1152
1153 51. Applied patches from Christian Persch to configure.ac to make use of the
1154 AC_USE_SYSTEM_EXTENSIONS macro and to test for functions used by the JIT
1155 modules.
1156
1157 52. Minor fixes to pcre2grep from Jason Hood:
1158 * fixed some spacing;
1159 * Windows doesn't usually use single quotes, so I've added a define
1160 to use appropriate quotes [in an example];
1161 * LC_ALL was displayed as "LCC_ALL";
1162 * numbers 11, 12 & 13 should end in "th";
1163 * use double quotes in usage message.
1164
1165 53. When autopossessifying, skip empty branches without recursion, to reduce
1166 stack usage for the benefit of clang with -fsanitize-address, which uses huge
1167 stack frames. Example pattern: /X?(R||){3335}/. Fixes oss-fuzz issue 553.
1168
1169 54. A pattern with very many explicit back references to a group that is a long
1170 way from the start of the pattern could take a long time to compile because
1171 searching for the referenced group in order to find the minimum length was
1172 being done repeatedly. Now up to 128 group minimum lengths are cached and the
1173 attempt to find a minimum length is abandoned if there is a back reference to a
1174 group whose number is greater than 128. (In that case, the pattern is so
1175 complicated that this optimization probably isn't worth it.) This fixes
1176 oss-fuzz issue 557.
1177
1178 55. Issue 32 for 10.22 below was not correctly fixed. If pcre2grep in multiline
1179 mode with --only-matching matched several lines, it restarted scanning at the
1180 next line instead of moving on to the end of the matched string, which can be
1181 several lines after the start.
1182
1183 56. Applied Jason Hood's new patch for RunGrepTest.bat that updates it in line
1184 with updates to the non-Windows version.
1185
1186
1187
1188 Version 10.22 29-July-2016
1189 --------------------------
1190
1191 1. Applied Jason Hood's patches to RunTest.bat and testdata/wintestoutput3
1192 to fix problems with running the tests under Windows.
1193
1194 2. Implemented a facility for quoting literal characters within hexadecimal
1195 patterns in pcre2test, to make it easier to create patterns with just a few
1196 non-printing characters.
1197
1198 3. Binary zeros are not supported in pcre2test input files. It now detects them
1199 and gives an error.
1200
1201 4. Updated the valgrind parameters in RunTest: (a) changed smc-check=all to
1202 smc-check=all-non-file; (b) changed obj:* in the suppression file to obj:??? so
1203 that it matches only unknown objects.
1204
1205 5. Updated the maintenance script maint/ManyConfigTests to make it easier to
1206 select individual groups of tests.
1207
1208 6. When the POSIX wrapper function regcomp() is called, the REG_NOSUB option
1209 used to set PCRE2_NO_AUTO_CAPTURE when calling pcre2_compile(). However, this
1210 disables the use of back references (and subroutine calls), which are supported
1211 by other implementations of regcomp() with RE_NOSUB. Therefore, REG_NOSUB no
1212 longer causes PCRE2_NO_AUTO_CAPTURE to be set, though it still ignores nmatch
1213 and pmatch when regexec() is called.
1214
1215 7. Because of 6 above, pcre2test has been modified with a new modifier called
1216 posix_nosub, to call regcomp() with REG_NOSUB. Previously the no_auto_capture
1217 modifier had this effect. That option is now ignored when the POSIX API is in
1218 use.
1219
1220 8. Minor tidies to the pcre2demo.c sample program, including more comments
1221 about its 8-bit-ness.
1222
1223 9. Detect unmatched closing parentheses and give the error in the pre-scan
1224 instead of later. Previously the pre-scan carried on and could give a
1225 misleading incorrect error message. For example, /(?J)(?'a'))(?'a')/ gave a
1226 message about invalid duplicate group names.
1227
1228 10. It has happened that pcre2test was accidentally linked with another POSIX
1229 regex library instead of libpcre2-posix. In this situation, a call to regcomp()
1230 (in the other library) may succeed, returning zero, but of course putting its
1231 own data into the regex_t block. In one example the re_pcre2_code field was
1232 left as NULL, which made pcre2test think it had not got a compiled POSIX regex,
1233 so it treated the next line as another pattern line, resulting in a confusing
1234 error message. A check has been added to pcre2test to see if the data returned
1235 from a successful call of regcomp() are valid for PCRE2's regcomp(). If they
1236 are not, an error message is output and the pcre2test run is abandoned. The
1237 message points out the possibility of a mis-linking. Hopefully this will avoid
1238 some head-scratching the next time this happens.
1239
1240 11. A pattern such as /(?<=((?C)0))/, which has a callout inside a lookbehind
1241 assertion, caused pcre2test to output a very large number of spaces when the
1242 callout was taken, making the program appearing to loop.
1243
1244 12. A pattern that included (*ACCEPT) in the middle of a sufficiently deeply
1245 nested set of parentheses of sufficient size caused an overflow of the
1246 compiling workspace (which was diagnosed, but of course is not desirable).
1247
1248 13. Detect missing closing parentheses during the pre-pass for group
1249 identification.
1250
1251 14. Changed some integer variable types and put in a number of casts, following
1252 a report of compiler warnings from Visual Studio 2013 and a few tests with
1253 gcc's -Wconversion (which still throws up a lot).
1254
1255 15. Implemented pcre2_code_copy(), and added pushcopy and #popcopy to pcre2test
1256 for testing it.
1257
1258 16. Change 66 for 10.21 introduced the use of snprintf() in PCRE2's version of
1259 regerror(). When the error buffer is too small, my version of snprintf() puts a
1260 binary zero in the final byte. Bug #1801 seems to show that other versions do
1261 not do this, leading to bad output from pcre2test when it was checking for
1262 buffer overflow. It no longer assumes a binary zero at the end of a too-small
1263 regerror() buffer.
1264
1265 17. Fixed typo ("&&" for "&") in pcre2_study(). Fortunately, this could not
1266 actually affect anything, by sheer luck.
1267
1268 18. Two minor fixes for MSVC compilation: (a) removal of apparently incorrect
1269 "const" qualifiers in pcre2test and (b) defining snprintf as _snprintf for
1270 older MSVC compilers. This has been done both in src/pcre2_internal.h for most
1271 of the library, and also in src/pcre2posix.c, which no longer includes
1272 pcre2_internal.h (see 24 below).
1273
1274 19. Applied Chris Wilson's patch (Bugzilla #1681) to CMakeLists.txt for MSVC
1275 static compilation. Subsequently applied Chris Wilson's second patch, putting
1276 the first patch under a new option instead of being unconditional when
1277 PCRE_STATIC is set.
1278
1279 20. Updated pcre2grep to set stdout as binary when run under Windows, so as not
1280 to convert \r\n at the ends of reflected lines into \r\r\n. This required
1281 ensuring that other output that is written to stdout (e.g. file names) uses the
1282 appropriate line terminator: \r\n for Windows, \n otherwise.
1283
1284 21. When a line is too long for pcre2grep's internal buffer, show the maximum
1285 length in the error message.
1286
1287 22. Added support for string callouts to pcre2grep (Zoltan's patch with PH
1288 additions).
1289
1290 23. RunTest.bat was missing a "set type" line for test 22.
1291
1292 24. The pcre2posix.c file was including pcre2_internal.h, and using some
1293 "private" knowledge of the data structures. This is unnecessary; the code has
1294 been re-factored and no longer includes pcre2_internal.h.
1295
1296 25. A racing condition is fixed in JIT reported by Mozilla.
1297
1298 26. Minor code refactor to avoid "array subscript is below array bounds"
1299 compiler warning.
1300
1301 27. Minor code refactor to avoid "left shift of negative number" warning.
1302
1303 28. Add a bit more sanity checking to pcre2_serialize_decode() and document
1304 that it expects trusted data.
1305
1306 29. Fix typo in pcre2_jit_test.c
1307
1308 30. Due to an oversight, pcre2grep was not making use of JIT when available.
1309 This is now fixed.
1310
1311 31. The RunGrepTest script is updated to use the valgrind suppressions file
1312 when testing with JIT under valgrind (compare 10.21/51 below). The suppressions
1313 file is updated so that is now the same as for PCRE1: it suppresses the
1314 Memcheck warnings Addr16 and Cond in unknown objects (that is, JIT-compiled
1315 code). Also changed smc-check=all to smc-check=all-non-file as was done for
1316 RunTest (see 4 above).
1317
1318 32. Implemented the PCRE2_NO_JIT option for pcre2_match().
1319
1320 33. Fix typo that gave a compiler error when JIT not supported.
1321
1322 34. Fix comment describing the returns from find_fixedlength().
1323
1324 35. Fix potential negative index in pcre2test.
1325
1326 36. Calls to pcre2_get_error_message() with error numbers that are never
1327 returned by PCRE2 functions were returning empty strings. Now the error code
1328 PCRE2_ERROR_BADDATA is returned. A facility has been added to pcre2test to
1329 show the texts for given error numbers (i.e. to call pcre2_get_error_message()
1330 and display what it returns) and a few representative error codes are now
1331 checked in RunTest.
1332
1333 37. Added "&& !defined(__INTEL_COMPILER)" to the test for __GNUC__ in
1334 pcre2_match.c, in anticipation that this is needed for the same reason it was
1335 recently added to pcrecpp.cc in PCRE1.
1336
1337 38. Using -o with -M in pcre2grep could cause unnecessary repeated output when
1338 the match extended over a line boundary, as it tried to find more matches "on
1339 the same line" - but it was already over the end.
1340
1341 39. Allow \C in lookbehinds and DFA matching in UTF-32 mode (by converting it
1342 to the same code as '.' when PCRE2_DOTALL is set).
1343
1344 40. Fix two clang compiler warnings in pcre2test when only one code unit width
1345 is supported.
1346
1347 41. Upgrade RunTest to automatically re-run test 2 with a large (64MiB) stack
1348 if it fails when running the interpreter with a 16MiB stack (and if changing
1349 the stack size via pcre2test is possible). This avoids having to manually set a
1350 large stack size when testing with clang.
1351
1352 42. Fix register overwite in JIT when SSE2 acceleration is enabled.
1353
1354 43. Detect integer overflow in pcre2test pattern and data repetition counts.
1355
1356 44. In pcre2test, ignore "allcaptures" after DFA matching.
1357
1358 45. Fix unaligned accesses on x86. Patch by Marc Mutz.
1359
1360 46. Fix some more clang compiler warnings.
1361
1362
1363 Version 10.21 12-January-2016
1364 -----------------------------
1365
1366 1. Improve matching speed of patterns starting with + or * in JIT.
1367
1368 2. Use memchr() to find the first character in an unanchored match in 8-bit
1369 mode in the interpreter. This gives a significant speed improvement.
1370
1371 3. Removed a redundant copy of the opcode_possessify table in the
1372 pcre2_auto_possessify.c source.
1373
1374 4. Fix typos in dftables.c for z/OS.
1375
1376 5. Change 36 for 10.20 broke the handling of [[:>:]] and [[:<:]] in that
1377 processing them could involve a buffer overflow if the following character was
1378 an opening parenthesis.
1379
1380 6. Change 36 for 10.20 also introduced a bug in processing this pattern:
1381 /((?x)(*:0))#(?'/. Specifically: if a setting of (?x) was followed by a (*MARK)
1382 setting (which (*:0) is), then (?x) did not get unset at the end of its group
1383 during the scan for named groups, and hence the external # was incorrectly
1384 treated as a comment and the invalid (?' at the end of the pattern was not
1385 diagnosed. This caused a buffer overflow during the real compile. This bug was
1386 discovered by Karl Skomski with the LLVM fuzzer.
1387
1388 7. Moved the pcre2_find_bracket() function from src/pcre2_compile.c into its
1389 own source module to avoid a circular dependency between src/pcre2_compile.c
1390 and src/pcre2_study.c
1391
1392 8. A callout with a string argument containing an opening square bracket, for
1393 example /(?C$[$)(?<]/, was incorrectly processed and could provoke a buffer
1394 overflow. This bug was discovered by Karl Skomski with the LLVM fuzzer.
1395
1396 9. The handling of callouts during the pre-pass for named group identification
1397 has been tightened up.
1398
1399 10. The quantifier {1} can be ignored, whether greedy, non-greedy, or
1400 possessive. This is a very minor optimization.
1401
1402 11. A possessively repeated conditional group that could match an empty string,
1403 for example, /(?(R))*+/, was incorrectly compiled.
1404
1405 12. The Unicode tables have been updated to Unicode 8.0.0 (thanks to Christian
1406 Persch).
1407
1408 13. An empty comment (?#) in a pattern was incorrectly processed and could
1409 provoke a buffer overflow. This bug was discovered by Karl Skomski with the
1410 LLVM fuzzer.
1411
1412 14. Fix infinite recursion in the JIT compiler when certain patterns such as
1413 /(?:|a|){100}x/ are analysed.
1414
1415 15. Some patterns with character classes involving [: and \\ were incorrectly
1416 compiled and could cause reading from uninitialized memory or an incorrect
1417 error diagnosis. Examples are: /[[:\\](?<[::]/ and /[[:\\](?'abc')[a:]. The
1418 first of these bugs was discovered by Karl Skomski with the LLVM fuzzer.
1419
1420 16. Pathological patterns containing many nested occurrences of [: caused
1421 pcre2_compile() to run for a very long time. This bug was found by the LLVM
1422 fuzzer.
1423
1424 17. A missing closing parenthesis for a callout with a string argument was not
1425 being diagnosed, possibly leading to a buffer overflow. This bug was found by
1426 the LLVM fuzzer.
1427
1428 18. A conditional group with only one branch has an implicit empty alternative
1429 branch and must therefore be treated as potentially matching an empty string.
1430
1431 19. If (?R was followed by - or + incorrect behaviour happened instead of a
1432 diagnostic. This bug was discovered by Karl Skomski with the LLVM fuzzer.
1433
1434 20. Another bug that was introduced by change 36 for 10.20: conditional groups
1435 whose condition was an assertion preceded by an explicit callout with a string
1436 argument might be incorrectly processed, especially if the string contained \Q.
1437 This bug was discovered by Karl Skomski with the LLVM fuzzer.
1438
1439 21. Compiling PCRE2 with the sanitize options of clang showed up a number of
1440 very pedantic coding infelicities and a buffer overflow while checking a UTF-8
1441 string if the final multi-byte UTF-8 character was truncated.
1442
1443 22. For Perl compatibility in EBCDIC environments, ranges such as a-z in a
1444 class, where both values are literal letters in the same case, omit the
1445 non-letter EBCDIC code points within the range.
1446
1447 23. Finding the minimum matching length of complex patterns with back
1448 references and/or recursions can take a long time. There is now a cut-off that
1449 gives up trying to find a minimum length when things get too complex.
1450
1451 24. An optimization has been added that speeds up finding the minimum matching
1452 length for patterns containing repeated capturing groups or recursions.
1453
1454 25. If a pattern contained a back reference to a group whose number was
1455 duplicated as a result of appearing in a (?|...) group, the computation of the
1456 minimum matching length gave a wrong result, which could cause incorrect "no
1457 match" errors. For such patterns, a minimum matching length cannot at present
1458 be computed.
1459
1460 26. Added a check for integer overflow in conditions (?(<digits>) and
1461 (?(R<digits>). This omission was discovered by Karl Skomski with the LLVM
1462 fuzzer.
1463
1464 27. Fixed an issue when \p{Any} inside an xclass did not read the current
1465 character.
1466
1467 28. If pcre2grep was given the -q option with -c or -l, or when handling a
1468 binary file, it incorrectly wrote output to stdout.
1469
1470 29. The JIT compiler did not restore the control verb head in case of *THEN
1471 control verbs. This issue was found by Karl Skomski with a custom LLVM fuzzer.
1472
1473 30. The way recursive references such as (?3) are compiled has been re-written
1474 because the old way was the cause of many issues. Now, conversion of the group
1475 number into a pattern offset does not happen until the pattern has been
1476 completely compiled. This does mean that detection of all infinitely looping
1477 recursions is postponed till match time. In the past, some easy ones were
1478 detected at compile time. This re-writing was done in response to yet another
1479 bug found by the LLVM fuzzer.
1480
1481 31. A test for a back reference to a non-existent group was missing for items
1482 such as \987. This caused incorrect code to be compiled. This issue was found
1483 by Karl Skomski with a custom LLVM fuzzer.
1484
1485 32. Error messages for syntax errors following \g and \k were giving inaccurate
1486 offsets in the pattern.
1487
1488 33. Improve the performance of starting single character repetitions in JIT.
1489
1490 34. (*LIMIT_MATCH=) now gives an error instead of setting the value to 0.
1491
1492 35. Error messages for syntax errors in *LIMIT_MATCH and *LIMIT_RECURSION now
1493 give the right offset instead of zero.
1494
1495 36. The JIT compiler should not check repeats after a {0,1} repeat byte code.
1496 This issue was found by Karl Skomski with a custom LLVM fuzzer.
1497
1498 37. The JIT compiler should restore the control chain for empty possessive
1499 repeats. This issue was found by Karl Skomski with a custom LLVM fuzzer.
1500
1501 38. A bug which was introduced by the single character repetition optimization
1502 was fixed.
1503
1504 39. Match limit check added to recursion. This issue was found by Karl Skomski
1505 with a custom LLVM fuzzer.
1506
1507 40. Arrange for the UTF check in pcre2_match() and pcre2_dfa_match() to look
1508 only at the part of the subject that is relevant when the starting offset is
1509 non-zero.
1510
1511 41. Improve first character match in JIT with SSE2 on x86.
1512
1513 42. Fix two assertion fails in JIT. These issues were found by Karl Skomski
1514 with a custom LLVM fuzzer.
1515
1516 43. Correct the setting of CMAKE_C_FLAGS in CMakeLists.txt (patch from Roy Ivy
1517 III).
1518
1519 44. Fix bug in RunTest.bat for new test 14, and adjust the script for the added
1520 test (there are now 20 in total).
1521
1522 45. Fixed a corner case of range optimization in JIT.
1523
1524 46. Add the ${*MARK} facility to pcre2_substitute().
1525
1526 47. Modifier lists in pcre2test were splitting at spaces without the required
1527 commas.
1528
1529 48. Implemented PCRE2_ALT_VERBNAMES.
1530
1531 49. Fixed two issues in JIT. These were found by Karl Skomski with a custom
1532 LLVM fuzzer.
1533
1534 50. The pcre2test program has been extended by adding the #newline_default
1535 command. This has made it possible to run the standard tests when PCRE2 is
1536 compiled with either CR or CRLF as the default newline convention. As part of
1537 this work, the new command was added to several test files and the testing
1538 scripts were modified. The pcre2grep tests can now also be run when there is no
1539 LF in the default newline convention.
1540
1541 51. The RunTest script has been modified so that, when JIT is used and valgrind
1542 is specified, a valgrind suppressions file is set up to ignore "Invalid read of
1543 size 16" errors because these are false positives when the hardware supports
1544 the SSE2 instruction set.
1545
1546 52. It is now possible to have comment lines amid the subject strings in
1547 pcre2test (and perltest.sh) input.
1548
1549 53. Implemented PCRE2_USE_OFFSET_LIMIT and pcre2_set_offset_limit().
1550
1551 54. Add the null_context modifier to pcre2test so that calling pcre2_compile()
1552 and the matching functions with NULL contexts can be tested.
1553
1554 55. Implemented PCRE2_SUBSTITUTE_EXTENDED.
1555
1556 56. In a character class such as [\W\p{Any}] where both a negative-type escape
1557 ("not a word character") and a property escape were present, the property
1558 escape was being ignored.
1559
1560 57. Fixed integer overflow for patterns whose minimum matching length is very,
1561 very large.
1562
1563 58. Implemented --never-backslash-C.
1564
1565 59. Change 55 above introduced a bug by which certain patterns provoked the
1566 erroneous error "\ at end of pattern".
1567
1568 60. The special sequences [[:<:]] and [[:>:]] gave rise to incorrect compiling
1569 errors or other strange effects if compiled in UCP mode. Found with libFuzzer
1570 and AddressSanitizer.
1571
1572 61. Whitespace at the end of a pcre2test pattern line caused a spurious error
1573 message if there were only single-character modifiers. It should be ignored.
1574
1575 62. The use of PCRE2_NO_AUTO_CAPTURE could cause incorrect compilation results
1576 or segmentation errors for some patterns. Found with libFuzzer and
1577 AddressSanitizer.
1578
1579 63. Very long names in (*MARK) or (*THEN) etc. items could provoke a buffer
1580 overflow.
1581
1582 64. Improve error message for overly-complicated patterns.
1583
1584 65. Implemented an optional replication feature for patterns in pcre2test, to
1585 make it easier to test long repetitive patterns. The tests for 63 above are
1586 converted to use the new feature.
1587
1588 66. In the POSIX wrapper, if regerror() was given too small a buffer, it could
1589 misbehave.
1590
1591 67. In pcre2_substitute() in UTF mode, the UTF validity check on the
1592 replacement string was happening before the length setting when the replacement
1593 string was zero-terminated.
1594
1595 68. In pcre2_substitute() in UTF mode, PCRE2_NO_UTF_CHECK can be set for the
1596 second and subsequent calls to pcre2_match().
1597
1598 69. There was no check for integer overflow for a replacement group number in
1599 pcre2_substitute(). An added check for a number greater than the largest group
1600 number in the pattern means this is not now needed.
1601
1602 70. The PCRE2-specific VERSION condition didn't work correctly if only one
1603 digit was given after the decimal point, or if more than two digits were given.
1604 It now works with one or two digits, and gives a compile time error if more are
1605 given.
1606
1607 71. In pcre2_substitute() there was the possibility of reading one code unit
1608 beyond the end of the replacement string.
1609
1610 72. The code for checking a subject's UTF-32 validity for a pattern with a
1611 lookbehind involved an out-of-bounds pointer, which could potentially cause
1612 trouble in some environments.
1613
1614 73. The maximum lookbehind length was incorrectly calculated for patterns such
1615 as /(?<=(a)(?-1))x/ which have a recursion within a backreference.
1616
1617 74. Give an error if a lookbehind assertion is longer than 65535 code units.
1618
1619 75. Give an error in pcre2_substitute() if a match ends before it starts (as a
1620 result of the use of \K).
1621
1622 76. Check the length of subpattern names and the names in (*MARK:xx) etc.
1623 dynamically to avoid the possibility of integer overflow.
1624
1625 77. Implement pcre2_set_max_pattern_length() so that programs can restrict the
1626 size of patterns that they are prepared to handle.
1627
1628 78. (*NO_AUTO_POSSESS) was not working.
1629
1630 79. Adding group information caching improves the speed of compiling when
1631 checking whether a group has a fixed length and/or could match an empty string,
1632 especially when recursion or subroutine calls are involved. However, this
1633 cannot be used when (?| is present in the pattern because the same number may
1634 be used for groups of different sizes. To catch runaway patterns in this
1635 situation, counts have been introduced to the functions that scan for empty
1636 branches or compute fixed lengths.
1637
1638 80. Allow for the possibility of the size of the nest_save structure not being
1639 a factor of the size of the compiling workspace (it currently is).
1640
1641 81. Check for integer overflow in minimum length calculation and cap it at
1642 65535.
1643
1644 82. Small optimizations in code for finding the minimum matching length.
1645
1646 83. Lock out configuring for EBCDIC with non-8-bit libraries.
1647
1648 84. Test for error code <= 0 in regerror().
1649
1650 85. Check for too many replacements (more than INT_MAX) in pcre2_substitute().
1651
1652 86. Avoid the possibility of computing with an out-of-bounds pointer (though
1653 not dereferencing it) while handling lookbehind assertions.
1654
1655 87. Failure to get memory for the match data in regcomp() is now given as a
1656 regcomp() error instead of waiting for regexec() to pick it up.
1657
1658 88. In pcre2_substitute(), ensure that CRLF is not split when it is a valid
1659 newline sequence.
1660
1661 89. Paranoid check in regcomp() for bad error code from pcre2_compile().
1662
1663 90. Run test 8 (internal offsets and code sizes) for link sizes 3 and 4 as well
1664 as for link size 2.
1665
1666 91. Document that JIT has a limit on pattern size, and give more information
1667 about JIT compile failures in pcre2test.
1668
1669 92. Implement PCRE2_INFO_HASBACKSLASHC.
1670
1671 93. Re-arrange valgrind support code in pcre2test to avoid spurious reports
1672 with JIT (possibly caused by SSE2?).
1673
1674 94. Support offset_limit in JIT.
1675
1676 95. A sequence such as [[:punct:]b] that is, a POSIX character class followed
1677 by a single ASCII character in a class item, was incorrectly compiled in UCP
1678 mode. The POSIX class got lost, but only if the single character followed it.
1679
1680 96. [:punct:] in UCP mode was matching some characters in the range 128-255
1681 that should not have been matched.
1682
1683 97. If [:^ascii:] or [:^xdigit:] are present in a non-negated class, all
1684 characters with code points greater than 255 are in the class. When a Unicode
1685 property was also in the class (if PCRE2_UCP is set, escapes such as \w are
1686 turned into Unicode properties), wide characters were not correctly handled,
1687 and could fail to match.
1688
1689 98. In pcre2test, make the "startoffset" modifier a synonym of "offset",
1690 because it sets the "startoffset" parameter for pcre2_match().
1691
1692 99. If PCRE2_AUTO_CALLOUT was set on a pattern that had a (?# comment between
1693 an item and its qualifier (for example, A(?#comment)?B) pcre2_compile()
1694 misbehaved. This bug was found by the LLVM fuzzer.
1695
1696 100. The error for an invalid UTF pattern string always gave the code unit
1697 offset as zero instead of where the invalidity was found.
1698
1699 101. Further to 97 above, negated classes such as [^[:^ascii:]\d] were also not
1700 working correctly in UCP mode.
1701
1702 102. Similar to 99 above, if an isolated \E was present between an item and its
1703 qualifier when PCRE2_AUTO_CALLOUT was set, pcre2_compile() misbehaved. This bug
1704 was found by the LLVM fuzzer.
1705
1706 103. The POSIX wrapper function regexec() crashed if the option REG_STARTEND
1707 was set when the pmatch argument was NULL. It now returns REG_INVARG.
1708
1709 104. Allow for up to 32-bit numbers in the ordin() function in pcre2grep.
1710
1711 105. An empty \Q\E sequence between an item and its qualifier caused
1712 pcre2_compile() to misbehave when auto callouts were enabled. This bug
1713 was found by the LLVM fuzzer.
1714
1715 106. If both PCRE2_ALT_VERBNAMES and PCRE2_EXTENDED were set, and a (*MARK) or
1716 other verb "name" ended with whitespace immediately before the closing
1717 parenthesis, pcre2_compile() misbehaved. Example: /(*:abc )/, but only when
1718 both those options were set.
1719
1720 107. In a number of places pcre2_compile() was not handling NULL characters
1721 correctly, and pcre2test with the "bincode" modifier was not always correctly
1722 displaying fields containing NULLS:
1723
1724 (a) Within /x extended #-comments
1725 (b) Within the "name" part of (*MARK) and other *verbs
1726 (c) Within the text argument of a callout
1727
1728 108. If a pattern that was compiled with PCRE2_EXTENDED started with white
1729 space or a #-type comment that was followed by (?-x), which turns off
1730 PCRE2_EXTENDED, and there was no subsequent (?x) to turn it on again,
1731 pcre2_compile() assumed that (?-x) applied to the whole pattern and
1732 consequently mis-compiled it. This bug was found by the LLVM fuzzer. The fix
1733 for this bug means that a setting of any of the (?imsxJU) options at the start
1734 of a pattern is no longer transferred to the options that are returned by
1735 PCRE2_INFO_ALLOPTIONS. In fact, this was an anachronism that should have
1736 changed when the effects of those options were all moved to compile time.
1737
1738 109. An escaped closing parenthesis in the "name" part of a (*verb) when
1739 PCRE2_ALT_VERBNAMES was set caused pcre2_compile() to malfunction. This bug
1740 was found by the LLVM fuzzer.
1741
1742 110. Implemented PCRE2_SUBSTITUTE_UNSET_EMPTY, and updated pcre2test to make it
1743 possible to test it.
1744
1745 111. "Harden" pcre2test against ridiculously large values in modifiers and
1746 command line arguments.
1747
1748 112. Implemented PCRE2_SUBSTITUTE_UNKNOWN_UNSET and PCRE2_SUBSTITUTE_OVERFLOW_
1749 LENGTH.
1750
1751 113. Fix printing of *MARK names that contain binary zeroes in pcre2test.
1752
1753
1754 Version 10.20 30-June-2015
1755 --------------------------
1756
1757 1. Callouts with string arguments have been added.
1758
1759 2. Assertion code generator in JIT has been optimized.
1760
1761 3. The invalid pattern (?(?C) has a missing assertion condition at the end. The
1762 pcre2_compile() function read past the end of the input before diagnosing an
1763 error. This bug was discovered by the LLVM fuzzer.
1764
1765 4. Implemented pcre2_callout_enumerate().
1766
1767 5. Fix JIT compilation of conditional blocks whose assertion is converted to
1768 (*FAIL). E.g: /(?(?!))/.
1769
1770 6. The pattern /(?(?!)^)/ caused references to random memory. This bug was
1771 discovered by the LLVM fuzzer.
1772
1773 7. The assertion (?!) is optimized to (*FAIL). This was not handled correctly
1774 when this assertion was used as a condition, for example (?(?!)a|b). In
1775 pcre2_match() it worked by luck; in pcre2_dfa_match() it gave an incorrect
1776 error about an unsupported item.
1777
1778 8. For some types of pattern, for example /Z*(|d*){216}/, the auto-
1779 possessification code could take exponential time to complete. A recursion
1780 depth limit of 1000 has been imposed to limit the resources used by this
1781 optimization. This infelicity was discovered by the LLVM fuzzer.
1782
1783 9. A pattern such as /(*UTF)[\S\V\H]/, which contains a negated special class
1784 such as \S in non-UCP mode, explicit wide characters (> 255) can be ignored
1785 because \S ensures they are all in the class. The code for doing this was
1786 interacting badly with the code for computing the amount of space needed to
1787 compile the pattern, leading to a buffer overflow. This bug was discovered by
1788 the LLVM fuzzer.
1789
1790 10. A pattern such as /((?2)+)((?1))/ which has mutual recursion nested inside
1791 other kinds of group caused stack overflow at compile time. This bug was
1792 discovered by the LLVM fuzzer.
1793
1794 11. A pattern such as /(?1)(?#?'){8}(a)/ which had a parenthesized comment
1795 between a subroutine call and its quantifier was incorrectly compiled, leading
1796 to buffer overflow or other errors. This bug was discovered by the LLVM fuzzer.
1797
1798 12. The illegal pattern /(?(?<E>.*!.*)?)/ was not being diagnosed as missing an
1799 assertion after (?(. The code was failing to check the character after (?(?<
1800 for the ! or = that would indicate a lookbehind assertion. This bug was
1801 discovered by the LLVM fuzzer.
1802
1803 13. A pattern such as /X((?2)()*+){2}+/ which has a possessive quantifier with
1804 a fixed maximum following a group that contains a subroutine reference was
1805 incorrectly compiled and could trigger buffer overflow. This bug was discovered
1806 by the LLVM fuzzer.
1807
1808 14. Negative relative recursive references such as (?-7) to non-existent
1809 subpatterns were not being diagnosed and could lead to unpredictable behaviour.
1810 This bug was discovered by the LLVM fuzzer.
1811
1812 15. The bug fixed in 14 was due to an integer variable that was unsigned when
1813 it should have been signed. Some other "int" variables, having been checked,
1814 have either been changed to uint32_t or commented as "must be signed".
1815
1816 16. A mutual recursion within a lookbehind assertion such as (?<=((?2))((?1)))
1817 caused a stack overflow instead of the diagnosis of a non-fixed length
1818 lookbehind assertion. This bug was discovered by the LLVM fuzzer.
1819
1820 17. The use of \K in a positive lookbehind assertion in a non-anchored pattern
1821 (e.g. /(?<=\Ka)/) could make pcre2grep loop.
1822
1823 18. There was a similar problem to 17 in pcre2test for global matches, though
1824 the code there did catch the loop.
1825
1826 19. If a greedy quantified \X was preceded by \C in UTF mode (e.g. \C\X*),
1827 and a subsequent item in the pattern caused a non-match, backtracking over the
1828 repeated \X did not stop, but carried on past the start of the subject, causing
1829 reference to random memory and/or a segfault. There were also some other cases
1830 where backtracking after \C could crash. This set of bugs was discovered by the
1831 LLVM fuzzer.
1832
1833 20. The function for finding the minimum length of a matching string could take
1834 a very long time if mutual recursion was present many times in a pattern, for
1835 example, /((?2){73}(?2))((?1))/. A better mutual recursion detection method has
1836 been implemented. This infelicity was discovered by the LLVM fuzzer.
1837
1838 21. Implemented PCRE2_NEVER_BACKSLASH_C.
1839
1840 22. The feature for string replication in pcre2test could read from freed
1841 memory if the replication required a buffer to be extended, and it was not
1842 working properly in 16-bit and 32-bit modes. This issue was discovered by a
1843 fuzzer: see http://lcamtuf.coredump.cx/afl/.
1844
1845 23. Added the PCRE2_ALT_CIRCUMFLEX option.
1846
1847 24. Adjust the treatment of \8 and \9 to be the same as the current Perl
1848 behaviour.
1849
1850 25. Static linking against the PCRE2 library using the pkg-config module was
1851 failing on missing pthread symbols.
1852
1853 26. If a group that contained a recursive back reference also contained a
1854 forward reference subroutine call followed by a non-forward-reference
1855 subroutine call, for example /.((?2)(?R)\1)()/, pcre2_compile() failed to
1856 compile correct code, leading to undefined behaviour or an internally detected
1857 error. This bug was discovered by the LLVM fuzzer.
1858
1859 27. Quantification of certain items (e.g. atomic back references) could cause
1860 incorrect code to be compiled when recursive forward references were involved.
1861 For example, in this pattern: /(?1)()((((((\1++))\x85)+)|))/. This bug was
1862 discovered by the LLVM fuzzer.
1863
1864 28. A repeated conditional group whose condition was a reference by name caused
1865 a buffer overflow if there was more than one group with the given name. This
1866 bug was discovered by the LLVM fuzzer.
1867
1868 29. A recursive back reference by name within a group that had the same name as
1869 another group caused a buffer overflow. For example: /(?J)(?'d'(?'d'\g{d}))/.
1870 This bug was discovered by the LLVM fuzzer.
1871
1872 30. A forward reference by name to a group whose number is the same as the
1873 current group, for example in this pattern: /(?|(\k'Pm')|(?'Pm'))/, caused a
1874 buffer overflow at compile time. This bug was discovered by the LLVM fuzzer.
1875
1876 31. Fix -fsanitize=undefined warnings for left shifts of 1 by 31 (it treats 1
1877 as an int; fixed by writing it as 1u).
1878
1879 32. Fix pcre2grep compile when -std=c99 is used with gcc, though it still gives
1880 a warning for "fileno" unless -std=gnu99 us used.
1881
1882 33. A lookbehind assertion within a set of mutually recursive subpatterns could
1883 provoke a buffer overflow. This bug was discovered by the LLVM fuzzer.
1884
1885 34. Give an error for an empty subpattern name such as (?'').
1886
1887 35. Make pcre2test give an error if a pattern that follows #forbud_utf contains
1888 \P, \p, or \X.
1889
1890 36. The way named subpatterns are handled has been refactored. There is now a
1891 pre-pass over the regex which does nothing other than identify named
1892 subpatterns and count the total captures. This means that information about
1893 named patterns is known before the rest of the compile. In particular, it means
1894 that forward references can be checked as they are encountered. Previously, the
1895 code for handling forward references was contorted and led to several errors in
1896 computing the memory requirements for some patterns, leading to buffer
1897 overflows.
1898
1899 37. There was no check for integer overflow in subroutine calls such as (?123).
1900
1901 38. The table entry for \l in EBCDIC environments was incorrect, leading to its
1902 being treated as a literal 'l' instead of causing an error.
1903
1904 39. If a non-capturing group containing a conditional group that could match
1905 an empty string was repeated, it was not identified as matching an empty string
1906 itself. For example: /^(?:(?(1)x|)+)+$()/.
1907
1908 40. In an EBCDIC environment, pcretest was mishandling the escape sequences
1909 \a and \e in test subject lines.
1910
1911 41. In an EBCDIC environment, \a in a pattern was converted to the ASCII
1912 instead of the EBCDIC value.
1913
1914 42. The handling of \c in an EBCDIC environment has been revised so that it is
1915 now compatible with the specification in Perl's perlebcdic page.
1916
1917 43. Single character repetition in JIT has been improved. 20-30% speedup
1918 was achieved on certain patterns.
1919
1920 44. The EBCDIC character 0x41 is a non-breaking space, equivalent to 0xa0 in
1921 ASCII/Unicode. This has now been added to the list of characters that are
1922 recognized as white space in EBCDIC.
1923
1924 45. When PCRE2 was compiled without Unicode support, the use of \p and \P gave
1925 an error (correctly) when used outside a class, but did not give an error
1926 within a class.
1927
1928 46. \h within a class was incorrectly compiled in EBCDIC environments.
1929
1930 47. JIT should return with error when the compiled pattern requires
1931 more stack space than the maximum.
1932
1933 48. Fixed a memory leak in pcre2grep when a locale is set.
1934
1935
1936 Version 10.10 06-March-2015
1937 ---------------------------
1938
1939 1. When a pattern is compiled, it remembers the highest back reference so that
1940 when matching, if the ovector is too small, extra memory can be obtained to
1941 use instead. A conditional subpattern whose condition is a check on a capture
1942 having happened, such as, for example in the pattern /^(?:(a)|b)(?(1)A|B)/, is
1943 another kind of back reference, but it was not setting the highest
1944 backreference number. This mattered only if pcre2_match() was called with an
1945 ovector that was too small to hold the capture, and there was no other kind of
1946 back reference (a situation which is probably quite rare). The effect of the
1947 bug was that the condition was always treated as FALSE when the capture could
1948 not be consulted, leading to a incorrect behaviour by pcre2_match(). This bug
1949 has been fixed.
1950
1951 2. Functions for serialization and deserialization of sets of compiled patterns
1952 have been added.
1953
1954 3. The value that is returned by PCRE2_INFO_SIZE has been corrected to remove
1955 excess code units at the end of the data block that may occasionally occur if
1956 the code for calculating the size over-estimates. This change stops the
1957 serialization code copying uninitialized data, to which valgrind objects. The
1958 documentation of PCRE2_INFO_SIZE was incorrect in stating that the size did not
1959 include the general overhead. This has been corrected.
1960
1961 4. All code units in every slot in the table of group names are now set, again
1962 in order to avoid accessing uninitialized data when serializing.
1963
1964 5. The (*NO_JIT) feature is implemented.
1965
1966 6. If a bug that caused pcre2_compile() to use more memory than allocated was
1967 triggered when using valgrind, the code in (3) above passed a stupidly large
1968 value to valgrind. This caused a crash instead of an "internal error" return.
1969
1970 7. A reference to a duplicated named group (either a back reference or a test
1971 for being set in a conditional) that occurred in a part of the pattern where
1972 PCRE2_DUPNAMES was not set caused the amount of memory needed for the pattern
1973 to be incorrectly calculated, leading to overwriting.
1974
1975 8. A mutually recursive set of back references such as (\2)(\1) caused a
1976 segfault at compile time (while trying to find the minimum matching length).
1977 The infinite loop is now broken (with the minimum length unset, that is, zero).
1978
1979 9. If an assertion that was used as a condition was quantified with a minimum
1980 of zero, matching went wrong. In particular, if the whole group had unlimited
1981 repetition and could match an empty string, a segfault was likely. The pattern
1982 (?(?=0)?)+ is an example that caused this. Perl allows assertions to be
1983 quantified, but not if they are being used as conditions, so the above pattern
1984 is faulted by Perl. PCRE2 has now been changed so that it also rejects such
1985 patterns.
1986
1987 10. The error message for an invalid quantifier has been changed from "nothing
1988 to repeat" to "quantifier does not follow a repeatable item".
1989
1990 11. If a bad UTF string is compiled with NO_UTF_CHECK, it may succeed, but
1991 scanning the compiled pattern in subsequent auto-possessification can get out
1992 of step and lead to an unknown opcode. Previously this could have caused an
1993 infinite loop. Now it generates an "internal error" error. This is a tidyup,
1994 not a bug fix; passing bad UTF with NO_UTF_CHECK is documented as having an
1995 undefined outcome.
1996
1997 12. A UTF pattern containing a "not" match of a non-ASCII character and a
1998 subroutine reference could loop at compile time. Example: /[^\xff]((?1))/.
1999
2000 13. The locale test (RunTest 3) has been upgraded. It now checks that a locale
2001 that is found in the output of "locale -a" can actually be set by pcre2test
2002 before it is accepted. Previously, in an environment where a locale was listed
2003 but would not set (an example does exist), the test would "pass" without
2004 actually doing anything. Also the fr_CA locale has been added to the list of
2005 locales that can be used.
2006
2007 14. Fixed a bug in pcre2_substitute(). If a replacement string ended in a
2008 capturing group number without parentheses, the last character was incorrectly
2009 literally included at the end of the replacement string.
2010
2011 15. A possessive capturing group such as (a)*+ with a minimum repeat of zero
2012 failed to allow the zero-repeat case if pcre2_match() was called with an
2013 ovector too small to capture the group.
2014
2015 16. Improved error message in pcre2test when setting the stack size (-S) fails.
2016
2017 17. Fixed two bugs in CMakeLists.txt: (1) Some lines had got lost in the
2018 transfer from PCRE1, meaning that CMake configuration failed if "build tests"
2019 was selected. (2) The file src/pcre2_serialize.c had not been added to the list
2020 of PCRE2 sources, which caused a failure to build pcre2test.
2021
2022 18. Fixed typo in pcre2_serialize.c (DECL instead of DEFN) that causes problems
2023 only on Windows.
2024
2025 19. Use binary input when reading back saved serialized patterns in pcre2test.
2026
2027 20. Added RunTest.bat for running the tests under Windows.
2028
2029 21. "make distclean" was not removing config.h, a file that may be created for
2030 use with CMake.
2031
2032 22. A pattern such as "((?2){0,1999}())?", which has a group containing a
2033 forward reference repeated a large (but limited) number of times within a
2034 repeated outer group that has a zero minimum quantifier, caused incorrect code
2035 to be compiled, leading to the error "internal error: previously-checked
2036 referenced subpattern not found" when an incorrect memory address was read.
2037 This bug was reported as "heap overflow", discovered by Kai Lu of Fortinet's
2038 FortiGuard Labs. (Added 24-March-2015: CVE-2015-2325 was given to this.)
2039
2040 23. A pattern such as "((?+1)(\1))/" containing a forward reference subroutine
2041 call within a group that also contained a recursive back reference caused
2042 incorrect code to be compiled. This bug was reported as "heap overflow",
2043 discovered by Kai Lu of Fortinet's FortiGuard Labs. (Added 24-March-2015:
2044 CVE-2015-2326 was given to this.)
2045
2046 24. Computing the size of the JIT read-only data in advance has been a source
2047 of various issues, and new ones are still appear unfortunately. To fix
2048 existing and future issues, size computation is eliminated from the code,
2049 and replaced by on-demand memory allocation.
2050
2051 25. A pattern such as /(?i)[A-`]/, where characters in the other case are
2052 adjacent to the end of the range, and the range contained characters with more
2053 than one other case, caused incorrect behaviour when compiled in UTF mode. In
2054 that example, the range a-j was left out of the class.
2055
2056
2057 Version 10.00 05-January-2015
2058 -----------------------------
2059
2060 Version 10.00 is the first release of PCRE2, a revised API for the PCRE
2061 library. Changes prior to 10.00 are logged in the ChangeLog file for the old
2062 API, up to item 20 for release 8.36.
2063
2064 The code of the library was heavily revised as part of the new API
2065 implementation. Details of each and every modification were not individually
2066 logged. In addition to the API changes, the following changes were made. They
2067 are either new functionality, or bug fixes and other noticeable changes of
2068 behaviour that were implemented after the code had been forked.
2069
2070 1. Including Unicode support at build time is now enabled by default, but it
2071 can optionally be disabled. It is not enabled by default at run time (no
2072 change).
2073
2074 2. The test program, now called pcre2test, was re-specified and almost
2075 completely re-written. Its input is not compatible with input for pcretest.
2076
2077 3. Patterns may start with (*NOTEMPTY) or (*NOTEMPTY_ATSTART) to set the
2078 PCRE2_NOTEMPTY or PCRE2_NOTEMPTY_ATSTART options for every subject line that is
2079 matched by that pattern.
2080
2081 4. For the benefit of those who use PCRE2 via some other application, that is,
2082 not writing the function calls themselves, it is possible to check the PCRE2
2083 version by matching a pattern such as /(?(VERSION>=10)yes|no)/ against a
2084 string such as "yesno".
2085
2086 5. There are case-equivalent Unicode characters whose encodings use different
2087 numbers of code units in UTF-8. U+023A and U+2C65 are one example. (It is
2088 theoretically possible for this to happen in UTF-16 too.) If a backreference to
2089 a group containing one of these characters was greedily repeated, and during
2090 the match a backtrack occurred, the subject might be backtracked by the wrong
2091 number of code units. For example, if /^(\x{23a})\1*(.)/ is matched caselessly
2092 (and in UTF-8 mode) against "\x{23a}\x{2c65}\x{2c65}\x{2c65}", group 2 should
2093 capture the final character, which is the three bytes E2, B1, and A5 in UTF-8.
2094 Incorrect backtracking meant that group 2 captured only the last two bytes.
2095 This bug has been fixed; the new code is slower, but it is used only when the
2096 strings matched by the repetition are not all the same length.
2097
2098 6. A pattern such as /()a/ was not setting the "first character must be 'a'"
2099 information. This applied to any pattern with a group that matched no
2100 characters, for example: /(?:(?=.)|(?<!x))a/.
2101
2102 7. When an (*ACCEPT) is triggered inside capturing parentheses, it arranges for
2103 those parentheses to be closed with whatever has been captured so far. However,
2104 it was failing to mark any other groups between the highest capture so far and
2105 the currrent group as "unset". Thus, the ovector for those groups contained
2106 whatever was previously there. An example is the pattern /(x)|((*ACCEPT))/ when
2107 matched against "abcd".
2108
2109 8. The pcre2_substitute() function has been implemented.
2110
2111 9. If an assertion used as a condition was quantified with a minimum of zero
2112 (an odd thing to do, but it happened), SIGSEGV or other misbehaviour could
2113 occur.
2114
2115 10. The PCRE2_NO_DOTSTAR_ANCHOR option has been implemented.
2116
2117 ****

  ViewVC Help
Powered by ViewVC 1.1.5