Home | History | Annotate | Download | only in dist2
      1 Change Log for PCRE2
      2 --------------------
      3 
      4 
      5 Version 10.22 29-July-2016
      6 --------------------------
      7 
      8 1. Applied Jason Hood's patches to RunTest.bat and testdata/wintestoutput3
      9 to fix problems with running the tests under Windows.
     10 
     11 2. Implemented a facility for quoting literal characters within hexadecimal
     12 patterns in pcre2test, to make it easier to create patterns with just a few
     13 non-printing characters.
     14 
     15 3. Binary zeros are not supported in pcre2test input files. It now detects them
     16 and gives an error.
     17 
     18 4. Updated the valgrind parameters in RunTest: (a) changed smc-check=all to
     19 smc-check=all-non-file; (b) changed obj:* in the suppression file to obj:??? so
     20 that it matches only unknown objects.
     21 
     22 5. Updated the maintenance script maint/ManyConfigTests to make it easier to
     23 select individual groups of tests.
     24 
     25 6. When the POSIX wrapper function regcomp() is called, the REG_NOSUB option
     26 used to set PCRE2_NO_AUTO_CAPTURE when calling pcre2_compile(). However, this
     27 disables the use of back references (and subroutine calls), which are supported
     28 by other implementations of regcomp() with RE_NOSUB. Therefore, REG_NOSUB no
     29 longer causes PCRE2_NO_AUTO_CAPTURE to be set, though it still ignores nmatch
     30 and pmatch when regexec() is called.
     31 
     32 7. Because of 6 above, pcre2test has been modified with a new modifier called
     33 posix_nosub, to call regcomp() with REG_NOSUB. Previously the no_auto_capture
     34 modifier had this effect. That option is now ignored when the POSIX API is in
     35 use.
     36 
     37 8. Minor tidies to the pcre2demo.c sample program, including more comments
     38 about its 8-bit-ness.
     39 
     40 9. Detect unmatched closing parentheses and give the error in the pre-scan
     41 instead of later. Previously the pre-scan carried on and could give a
     42 misleading incorrect error message. For example, /(?J)(?'a'))(?'a')/ gave a
     43 message about invalid duplicate group names.
     44 
     45 10. It has happened that pcre2test was accidentally linked with another POSIX
     46 regex library instead of libpcre2-posix. In this situation, a call to regcomp()
     47 (in the other library) may succeed, returning zero, but of course putting its
     48 own data into the regex_t block. In one example the re_pcre2_code field was
     49 left as NULL, which made pcre2test think it had not got a compiled POSIX regex,
     50 so it treated the next line as another pattern line, resulting in a confusing
     51 error message. A check has been added to pcre2test to see if the data returned
     52 from a successful call of regcomp() are valid for PCRE2's regcomp(). If they
     53 are not, an error message is output and the pcre2test run is abandoned. The
     54 message points out the possibility of a mis-linking. Hopefully this will avoid
     55 some head-scratching the next time this happens.
     56 
     57 11. A pattern such as /(?<=((?C)0))/, which has a callout inside a lookbehind
     58 assertion, caused pcre2test to output a very large number of spaces when the
     59 callout was taken, making the program appearing to loop.
     60 
     61 12. A pattern that included (*ACCEPT) in the middle of a sufficiently deeply
     62 nested set of parentheses of sufficient size caused an overflow of the
     63 compiling workspace (which was diagnosed, but of course is not desirable).
     64 
     65 13. Detect missing closing parentheses during the pre-pass for group
     66 identification.
     67 
     68 14. Changed some integer variable types and put in a number of casts, following
     69 a report of compiler warnings from Visual Studio 2013 and a few tests with
     70 gcc's -Wconversion (which still throws up a lot).
     71 
     72 15. Implemented pcre2_code_copy(), and added pushcopy and #popcopy to pcre2test
     73 for testing it.
     74 
     75 16. Change 66 for 10.21 introduced the use of snprintf() in PCRE2's version of
     76 regerror(). When the error buffer is too small, my version of snprintf() puts a
     77 binary zero in the final byte. Bug #1801 seems to show that other versions do
     78 not do this, leading to bad output from pcre2test when it was checking for
     79 buffer overflow. It no longer assumes a binary zero at the end of a too-small
     80 regerror() buffer.
     81 
     82 17. Fixed typo ("&&" for "&") in pcre2_study(). Fortunately, this could not
     83 actually affect anything, by sheer luck.
     84 
     85 18. Two minor fixes for MSVC compilation: (a) removal of apparently incorrect
     86 "const" qualifiers in pcre2test and (b) defining snprintf as _snprintf for
     87 older MSVC compilers. This has been done both in src/pcre2_internal.h for most
     88 of the library, and also in src/pcre2posix.c, which no longer includes
     89 pcre2_internal.h (see 24 below).
     90 
     91 19. Applied Chris Wilson's patch (Bugzilla #1681) to CMakeLists.txt for MSVC
     92 static compilation. Subsequently applied Chris Wilson's second patch, putting
     93 the first patch under a new option instead of being unconditional when
     94 PCRE_STATIC is set.
     95 
     96 20. Updated pcre2grep to set stdout as binary when run under Windows, so as not
     97 to convert \r\n at the ends of reflected lines into \r\r\n. This required
     98 ensuring that other output that is written to stdout (e.g. file names) uses the
     99 appropriate line terminator: \r\n for Windows, \n otherwise.
    100 
    101 21. When a line is too long for pcre2grep's internal buffer, show the maximum
    102 length in the error message.
    103 
    104 22. Added support for string callouts to pcre2grep (Zoltan's patch with PH
    105 additions).
    106 
    107 23. RunTest.bat was missing a "set type" line for test 22.
    108 
    109 24. The pcre2posix.c file was including pcre2_internal.h, and using some
    110 "private" knowledge of the data structures. This is unnecessary; the code has
    111 been re-factored and no longer includes pcre2_internal.h.
    112 
    113 25. A racing condition is fixed in JIT reported by Mozilla.
    114 
    115 26. Minor code refactor to avoid "array subscript is below array bounds"
    116 compiler warning.
    117 
    118 27. Minor code refactor to avoid "left shift of negative number" warning.
    119 
    120 28. Add a bit more sanity checking to pcre2_serialize_decode() and document
    121 that it expects trusted data.
    122 
    123 29. Fix typo in pcre2_jit_test.c
    124 
    125 30. Due to an oversight, pcre2grep was not making use of JIT when available.
    126 This is now fixed.
    127 
    128 31. The RunGrepTest script is updated to use the valgrind suppressions file
    129 when testing with JIT under valgrind (compare 10.21/51 below). The suppressions
    130 file is updated so that is now the same as for PCRE1: it suppresses the
    131 Memcheck warnings Addr16 and Cond in unknown objects (that is, JIT-compiled
    132 code). Also changed smc-check=all to smc-check=all-non-file as was done for
    133 RunTest (see 4 above).
    134 
    135 32. Implemented the PCRE2_NO_JIT option for pcre2_match().
    136 
    137 33. Fix typo that gave a compiler error when JIT not supported.
    138 
    139 34. Fix comment describing the returns from find_fixedlength().
    140 
    141 35. Fix potential negative index in pcre2test.
    142 
    143 36. Calls to pcre2_get_error_message() with error numbers that are never
    144 returned by PCRE2 functions were returning empty strings. Now the error code
    145 PCRE2_ERROR_BADDATA is returned. A facility has been added to pcre2test to
    146 show the texts for given error numbers (i.e. to call pcre2_get_error_message()
    147 and display what it returns) and a few representative error codes are now
    148 checked in RunTest.
    149 
    150 37. Added "&& !defined(__INTEL_COMPILER)" to the test for __GNUC__ in
    151 pcre2_match.c, in anticipation that this is needed for the same reason it was
    152 recently added to pcrecpp.cc in PCRE1.
    153 
    154 38. Using -o with -M in pcre2grep could cause unnecessary repeated output when
    155 the match extended over a line boundary, as it tried to find more matches "on
    156 the same line" - but it was already over the end.
    157 
    158 39. Allow \C in lookbehinds and DFA matching in UTF-32 mode (by converting it
    159 to the same code as '.' when PCRE2_DOTALL is set).
    160 
    161 40. Fix two clang compiler warnings in pcre2test when only one code unit width
    162 is supported.
    163 
    164 41. Upgrade RunTest to automatically re-run test 2 with a large (64M) stack if
    165 it fails when running the interpreter with a 16M stack (and if changing the
    166 stack size via pcre2test is possible). This avoids having to manually set a
    167 large stack size when testing with clang.
    168 
    169 42. Fix register overwite in JIT when SSE2 acceleration is enabled.
    170 
    171 43. Detect integer overflow in pcre2test pattern and data repetition counts.
    172 
    173 44. In pcre2test, ignore "allcaptures" after DFA matching.
    174 
    175 45. Fix unaligned accesses on x86. Patch by Marc Mutz.
    176 
    177 46. Fix some more clang compiler warnings.
    178 
    179 
    180 Version 10.21 12-January-2016
    181 -----------------------------
    182 
    183 1. Improve matching speed of patterns starting with + or * in JIT.
    184 
    185 2. Use memchr() to find the first character in an unanchored match in 8-bit
    186 mode in the interpreter. This gives a significant speed improvement.
    187 
    188 3. Removed a redundant copy of the opcode_possessify table in the
    189 pcre2_auto_possessify.c source.
    190 
    191 4. Fix typos in dftables.c for z/OS.
    192 
    193 5. Change 36 for 10.20 broke the handling of [[:>:]] and [[:<:]] in that
    194 processing them could involve a buffer overflow if the following character was
    195 an opening parenthesis.
    196 
    197 6. Change 36 for 10.20 also introduced a bug in processing this pattern:
    198 /((?x)(*:0))#(?'/. Specifically: if a setting of (?x) was followed by a (*MARK)
    199 setting (which (*:0) is), then (?x) did not get unset at the end of its group
    200 during the scan for named groups, and hence the external # was incorrectly
    201 treated as a comment and the invalid (?' at the end of the pattern was not
    202 diagnosed. This caused a buffer overflow during the real compile. This bug was
    203 discovered by Karl Skomski with the LLVM fuzzer.
    204 
    205 7. Moved the pcre2_find_bracket() function from src/pcre2_compile.c into its
    206 own source module to avoid a circular dependency between src/pcre2_compile.c
    207 and src/pcre2_study.c
    208 
    209 8. A callout with a string argument containing an opening square bracket, for
    210 example /(?C$[$)(?<]/, was incorrectly processed and could provoke a buffer
    211 overflow. This bug was discovered by Karl Skomski with the LLVM fuzzer.
    212 
    213 9. The handling of callouts during the pre-pass for named group identification
    214 has been tightened up.
    215 
    216 10. The quantifier {1} can be ignored, whether greedy, non-greedy, or
    217 possessive. This is a very minor optimization.
    218 
    219 11. A possessively repeated conditional group that could match an empty string,
    220 for example, /(?(R))*+/, was incorrectly compiled.
    221 
    222 12. The Unicode tables have been updated to Unicode 8.0.0 (thanks to Christian
    223 Persch).
    224 
    225 13. An empty comment (?#) in a pattern was incorrectly processed and could
    226 provoke a buffer overflow. This bug was discovered by Karl Skomski with the
    227 LLVM fuzzer.
    228 
    229 14. Fix infinite recursion in the JIT compiler when certain patterns such as
    230 /(?:|a|){100}x/ are analysed.
    231 
    232 15. Some patterns with character classes involving [: and \\ were incorrectly
    233 compiled and could cause reading from uninitialized memory or an incorrect
    234 error diagnosis. Examples are: /[[:\\](?<[::]/ and /[[:\\](?'abc')[a:]. The
    235 first of these bugs was discovered by Karl Skomski with the LLVM fuzzer.
    236 
    237 16. Pathological patterns containing many nested occurrences of [: caused
    238 pcre2_compile() to run for a very long time. This bug was found by the LLVM
    239 fuzzer.
    240 
    241 17. A missing closing parenthesis for a callout with a string argument was not
    242 being diagnosed, possibly leading to a buffer overflow. This bug was found by
    243 the LLVM fuzzer.
    244 
    245 18. A conditional group with only one branch has an implicit empty alternative
    246 branch and must therefore be treated as potentially matching an empty string.
    247 
    248 19. If (?R was followed by - or + incorrect behaviour happened instead of a
    249 diagnostic. This bug was discovered by Karl Skomski with the LLVM fuzzer.
    250 
    251 20. Another bug that was introduced by change 36 for 10.20: conditional groups
    252 whose condition was an assertion preceded by an explicit callout with a string
    253 argument might be incorrectly processed, especially if the string contained \Q.
    254 This bug was discovered by Karl Skomski with the LLVM fuzzer.
    255 
    256 21. Compiling PCRE2 with the sanitize options of clang showed up a number of
    257 very pedantic coding infelicities and a buffer overflow while checking a UTF-8
    258 string if the final multi-byte UTF-8 character was truncated.
    259 
    260 22. For Perl compatibility in EBCDIC environments, ranges such as a-z in a
    261 class, where both values are literal letters in the same case, omit the
    262 non-letter EBCDIC code points within the range.
    263 
    264 23. Finding the minimum matching length of complex patterns with back
    265 references and/or recursions can take a long time. There is now a cut-off that
    266 gives up trying to find a minimum length when things get too complex.
    267 
    268 24. An optimization has been added that speeds up finding the minimum matching
    269 length for patterns containing repeated capturing groups or recursions.
    270 
    271 25. If a pattern contained a back reference to a group whose number was
    272 duplicated as a result of appearing in a (?|...) group, the computation of the
    273 minimum matching length gave a wrong result, which could cause incorrect "no
    274 match" errors. For such patterns, a minimum matching length cannot at present
    275 be computed.
    276 
    277 26. Added a check for integer overflow in conditions (?(<digits>) and
    278 (?(R<digits>). This omission was discovered by Karl Skomski with the LLVM
    279 fuzzer.
    280 
    281 27. Fixed an issue when \p{Any} inside an xclass did not read the current
    282 character.
    283 
    284 28. If pcre2grep was given the -q option with -c or -l, or when handling a
    285 binary file, it incorrectly wrote output to stdout.
    286 
    287 29. The JIT compiler did not restore the control verb head in case of *THEN
    288 control verbs. This issue was found by Karl Skomski with a custom LLVM fuzzer.
    289 
    290 30. The way recursive references such as (?3) are compiled has been re-written
    291 because the old way was the cause of many issues. Now, conversion of the group
    292 number into a pattern offset does not happen until the pattern has been
    293 completely compiled. This does mean that detection of all infinitely looping
    294 recursions is postponed till match time. In the past, some easy ones were
    295 detected at compile time. This re-writing was done in response to yet another
    296 bug found by the LLVM fuzzer.
    297 
    298 31. A test for a back reference to a non-existent group was missing for items
    299 such as \987. This caused incorrect code to be compiled. This issue was found
    300 by Karl Skomski with a custom LLVM fuzzer.
    301 
    302 32. Error messages for syntax errors following \g and \k were giving inaccurate
    303 offsets in the pattern.
    304 
    305 33. Improve the performance of starting single character repetitions in JIT.
    306 
    307 34. (*LIMIT_MATCH=) now gives an error instead of setting the value to 0.
    308 
    309 35. Error messages for syntax errors in *LIMIT_MATCH and *LIMIT_RECURSION now
    310 give the right offset instead of zero.
    311 
    312 36. The JIT compiler should not check repeats after a {0,1} repeat byte code.
    313 This issue was found by Karl Skomski with a custom LLVM fuzzer.
    314 
    315 37. The JIT compiler should restore the control chain for empty possessive
    316 repeats. This issue was found by Karl Skomski with a custom LLVM fuzzer.
    317 
    318 38. A bug which was introduced by the single character repetition optimization
    319 was fixed.
    320 
    321 39. Match limit check added to recursion. This issue was found by Karl Skomski
    322 with a custom LLVM fuzzer.
    323 
    324 40. Arrange for the UTF check in pcre2_match() and pcre2_dfa_match() to look
    325 only at the part of the subject that is relevant when the starting offset is
    326 non-zero.
    327 
    328 41. Improve first character match in JIT with SSE2 on x86.
    329 
    330 42. Fix two assertion fails in JIT. These issues were found by Karl Skomski
    331 with a custom LLVM fuzzer.
    332 
    333 43. Correct the setting of CMAKE_C_FLAGS in CMakeLists.txt (patch from Roy Ivy
    334 III).
    335 
    336 44. Fix bug in RunTest.bat for new test 14, and adjust the script for the added
    337 test (there are now 20 in total).
    338 
    339 45. Fixed a corner case of range optimization in JIT.
    340 
    341 46. Add the ${*MARK} facility to pcre2_substitute().
    342 
    343 47. Modifier lists in pcre2test were splitting at spaces without the required
    344 commas.
    345 
    346 48. Implemented PCRE2_ALT_VERBNAMES.
    347 
    348 49. Fixed two issues in JIT. These were found by Karl Skomski with a custom
    349 LLVM fuzzer.
    350 
    351 50. The pcre2test program has been extended by adding the #newline_default
    352 command. This has made it possible to run the standard tests when PCRE2 is
    353 compiled with either CR or CRLF as the default newline convention. As part of
    354 this work, the new command was added to several test files and the testing
    355 scripts were modified. The pcre2grep tests can now also be run when there is no
    356 LF in the default newline convention.
    357 
    358 51. The RunTest script has been modified so that, when JIT is used and valgrind
    359 is specified, a valgrind suppressions file is set up to ignore "Invalid read of
    360 size 16" errors because these are false positives when the hardware supports
    361 the SSE2 instruction set.
    362 
    363 52. It is now possible to have comment lines amid the subject strings in
    364 pcre2test (and perltest.sh) input.
    365 
    366 53. Implemented PCRE2_USE_OFFSET_LIMIT and pcre2_set_offset_limit().
    367 
    368 54. Add the null_context modifier to pcre2test so that calling pcre2_compile()
    369 and the matching functions with NULL contexts can be tested.
    370 
    371 55. Implemented PCRE2_SUBSTITUTE_EXTENDED.
    372 
    373 56. In a character class such as [\W\p{Any}] where both a negative-type escape
    374 ("not a word character") and a property escape were present, the property
    375 escape was being ignored.
    376 
    377 57. Fixed integer overflow for patterns whose minimum matching length is very,
    378 very large.
    379 
    380 58. Implemented --never-backslash-C.
    381 
    382 59. Change 55 above introduced a bug by which certain patterns provoked the
    383 erroneous error "\ at end of pattern".
    384 
    385 60. The special sequences [[:<:]] and [[:>:]] gave rise to incorrect compiling
    386 errors or other strange effects if compiled in UCP mode. Found with libFuzzer
    387 and AddressSanitizer.
    388 
    389 61. Whitespace at the end of a pcre2test pattern line caused a spurious error
    390 message if there were only single-character modifiers. It should be ignored.
    391 
    392 62. The use of PCRE2_NO_AUTO_CAPTURE could cause incorrect compilation results
    393 or segmentation errors for some patterns. Found with libFuzzer and
    394 AddressSanitizer.
    395 
    396 63. Very long names in (*MARK) or (*THEN) etc. items could provoke a buffer
    397 overflow.
    398 
    399 64. Improve error message for overly-complicated patterns.
    400 
    401 65. Implemented an optional replication feature for patterns in pcre2test, to
    402 make it easier to test long repetitive patterns. The tests for 63 above are
    403 converted to use the new feature.
    404 
    405 66. In the POSIX wrapper, if regerror() was given too small a buffer, it could
    406 misbehave.
    407 
    408 67. In pcre2_substitute() in UTF mode, the UTF validity check on the
    409 replacement string was happening before the length setting when the replacement
    410 string was zero-terminated.
    411 
    412 68. In pcre2_substitute() in UTF mode, PCRE2_NO_UTF_CHECK can be set for the
    413 second and subsequent calls to pcre2_match().
    414 
    415 69. There was no check for integer overflow for a replacement group number in
    416 pcre2_substitute(). An added check for a number greater than the largest group
    417 number in the pattern means this is not now needed.
    418 
    419 70. The PCRE2-specific VERSION condition didn't work correctly if only one
    420 digit was given after the decimal point, or if more than two digits were given.
    421 It now works with one or two digits, and gives a compile time error if more are
    422 given.
    423 
    424 71. In pcre2_substitute() there was the possibility of reading one code unit
    425 beyond the end of the replacement string.
    426 
    427 72. The code for checking a subject's UTF-32 validity for a pattern with a
    428 lookbehind involved an out-of-bounds pointer, which could potentially cause
    429 trouble in some environments.
    430 
    431 73. The maximum lookbehind length was incorrectly calculated for patterns such
    432 as /(?<=(a)(?-1))x/ which have a recursion within a backreference.
    433 
    434 74. Give an error if a lookbehind assertion is longer than 65535 code units.
    435 
    436 75. Give an error in pcre2_substitute() if a match ends before it starts (as a
    437 result of the use of \K).
    438 
    439 76. Check the length of subpattern names and the names in (*MARK:xx) etc.
    440 dynamically to avoid the possibility of integer overflow.
    441 
    442 77. Implement pcre2_set_max_pattern_length() so that programs can restrict the
    443 size of patterns that they are prepared to handle.
    444 
    445 78. (*NO_AUTO_POSSESS) was not working.
    446 
    447 79. Adding group information caching improves the speed of compiling when
    448 checking whether a group has a fixed length and/or could match an empty string,
    449 especially when recursion or subroutine calls are involved. However, this
    450 cannot be used when (?| is present in the pattern because the same number may
    451 be used for groups of different sizes. To catch runaway patterns in this
    452 situation, counts have been introduced to the functions that scan for empty
    453 branches or compute fixed lengths.
    454 
    455 80. Allow for the possibility of the size of the nest_save structure not being
    456 a factor of the size of the compiling workspace (it currently is).
    457 
    458 81. Check for integer overflow in minimum length calculation and cap it at
    459 65535.
    460 
    461 82. Small optimizations in code for finding the minimum matching length.
    462 
    463 83. Lock out configuring for EBCDIC with non-8-bit libraries.
    464 
    465 84. Test for error code <= 0 in regerror().
    466 
    467 85. Check for too many replacements (more than INT_MAX) in pcre2_substitute().
    468 
    469 86. Avoid the possibility of computing with an out-of-bounds pointer (though
    470 not dereferencing it) while handling lookbehind assertions.
    471 
    472 87. Failure to get memory for the match data in regcomp() is now given as a
    473 regcomp() error instead of waiting for regexec() to pick it up.
    474 
    475 88. In pcre2_substitute(), ensure that CRLF is not split when it is a valid
    476 newline sequence.
    477 
    478 89. Paranoid check in regcomp() for bad error code from pcre2_compile().
    479 
    480 90. Run test 8 (internal offsets and code sizes) for link sizes 3 and 4 as well
    481 as for link size 2.
    482 
    483 91. Document that JIT has a limit on pattern size, and give more information
    484 about JIT compile failures in pcre2test.
    485 
    486 92. Implement PCRE2_INFO_HASBACKSLASHC.
    487 
    488 93. Re-arrange valgrind support code in pcre2test to avoid spurious reports
    489 with JIT (possibly caused by SSE2?).
    490 
    491 94. Support offset_limit in JIT.
    492 
    493 95. A sequence such as [[:punct:]b] that is, a POSIX character class followed
    494 by a single ASCII character in a class item, was incorrectly compiled in UCP
    495 mode. The POSIX class got lost, but only if the single character followed it.
    496 
    497 96. [:punct:] in UCP mode was matching some characters in the range 128-255
    498 that should not have been matched.
    499 
    500 97. If [:^ascii:] or [:^xdigit:] are present in a non-negated class, all
    501 characters with code points greater than 255 are in the class. When a Unicode
    502 property was also in the class (if PCRE2_UCP is set, escapes such as \w are
    503 turned into Unicode properties), wide characters were not correctly handled,
    504 and could fail to match.
    505 
    506 98. In pcre2test, make the "startoffset" modifier a synonym of "offset",
    507 because it sets the "startoffset" parameter for pcre2_match().
    508 
    509 99. If PCRE2_AUTO_CALLOUT was set on a pattern that had a (?# comment between
    510 an item and its qualifier (for example, A(?#comment)?B) pcre2_compile()
    511 misbehaved. This bug was found by the LLVM fuzzer.
    512 
    513 100. The error for an invalid UTF pattern string always gave the code unit
    514 offset as zero instead of where the invalidity was found.
    515 
    516 101. Further to 97 above, negated classes such as [^[:^ascii:]\d] were also not
    517 working correctly in UCP mode.
    518 
    519 102. Similar to 99 above, if an isolated \E was present between an item and its
    520 qualifier when PCRE2_AUTO_CALLOUT was set, pcre2_compile() misbehaved. This bug
    521 was found by the LLVM fuzzer.
    522 
    523 103. The POSIX wrapper function regexec() crashed if the option REG_STARTEND
    524 was set when the pmatch argument was NULL. It now returns REG_INVARG.
    525 
    526 104. Allow for up to 32-bit numbers in the ordin() function in pcre2grep.
    527 
    528 105. An empty \Q\E sequence between an item and its qualifier caused
    529 pcre2_compile() to misbehave when auto callouts were enabled. This bug
    530 was found by the LLVM fuzzer.
    531 
    532 106. If both PCRE2_ALT_VERBNAMES and PCRE2_EXTENDED were set, and a (*MARK) or
    533 other verb "name" ended with whitespace immediately before the closing
    534 parenthesis, pcre2_compile() misbehaved. Example: /(*:abc )/, but only when
    535 both those options were set.
    536 
    537 107. In a number of places pcre2_compile() was not handling NULL characters
    538 correctly, and pcre2test with the "bincode" modifier was not always correctly
    539 displaying fields containing NULLS:
    540 
    541    (a) Within /x extended #-comments
    542    (b) Within the "name" part of (*MARK) and other *verbs
    543    (c) Within the text argument of a callout
    544 
    545 108. If a pattern that was compiled with PCRE2_EXTENDED started with white
    546 space or a #-type comment that was followed by (?-x), which turns off
    547 PCRE2_EXTENDED, and there was no subsequent (?x) to turn it on again,
    548 pcre2_compile() assumed that (?-x) applied to the whole pattern and
    549 consequently mis-compiled it. This bug was found by the LLVM fuzzer. The fix
    550 for this bug means that a setting of any of the (?imsxJU) options at the start
    551 of a pattern is no longer transferred to the options that are returned by
    552 PCRE2_INFO_ALLOPTIONS. In fact, this was an anachronism that should have
    553 changed when the effects of those options were all moved to compile time.
    554 
    555 109. An escaped closing parenthesis in the "name" part of a (*verb) when
    556 PCRE2_ALT_VERBNAMES was set caused pcre2_compile() to malfunction. This bug
    557 was found by the LLVM fuzzer.
    558 
    559 110. Implemented PCRE2_SUBSTITUTE_UNSET_EMPTY, and updated pcre2test to make it
    560 possible to test it.
    561 
    562 111. "Harden" pcre2test against ridiculously large values in modifiers and
    563 command line arguments.
    564 
    565 112. Implemented PCRE2_SUBSTITUTE_UNKNOWN_UNSET and PCRE2_SUBSTITUTE_OVERFLOW_
    566 LENGTH.
    567 
    568 113. Fix printing of *MARK names that contain binary zeroes in pcre2test.
    569 
    570 
    571 Version 10.20 30-June-2015
    572 --------------------------
    573 
    574 1. Callouts with string arguments have been added.
    575 
    576 2. Assertion code generator in JIT has been optimized.
    577 
    578 3. The invalid pattern (?(?C) has a missing assertion condition at the end. The
    579 pcre2_compile() function read past the end of the input before diagnosing an
    580 error. This bug was discovered by the LLVM fuzzer.
    581 
    582 4. Implemented pcre2_callout_enumerate().
    583 
    584 5. Fix JIT compilation of conditional blocks whose assertion is converted to
    585 (*FAIL). E.g: /(?(?!))/.
    586 
    587 6. The pattern /(?(?!)^)/ caused references to random memory. This bug was
    588 discovered by the LLVM fuzzer.
    589 
    590 7. The assertion (?!) is optimized to (*FAIL). This was not handled correctly
    591 when this assertion was used as a condition, for example (?(?!)a|b). In
    592 pcre2_match() it worked by luck; in pcre2_dfa_match() it gave an incorrect
    593 error about an unsupported item.
    594 
    595 8. For some types of pattern, for example /Z*(|d*){216}/, the auto-
    596 possessification code could take exponential time to complete. A recursion
    597 depth limit of 1000 has been imposed to limit the resources used by this
    598 optimization. This infelicity was discovered by the LLVM fuzzer.
    599 
    600 9. A pattern such as /(*UTF)[\S\V\H]/, which contains a negated special class
    601 such as \S in non-UCP mode, explicit wide characters (> 255) can be ignored
    602 because \S ensures they are all in the class. The code for doing this was
    603 interacting badly with the code for computing the amount of space needed to
    604 compile the pattern, leading to a buffer overflow. This bug was discovered by
    605 the LLVM fuzzer.
    606 
    607 10. A pattern such as /((?2)+)((?1))/ which has mutual recursion nested inside
    608 other kinds of group caused stack overflow at compile time. This bug was
    609 discovered by the LLVM fuzzer.
    610 
    611 11. A pattern such as /(?1)(?#?'){8}(a)/ which had a parenthesized comment
    612 between a subroutine call and its quantifier was incorrectly compiled, leading
    613 to buffer overflow or other errors. This bug was discovered by the LLVM fuzzer.
    614 
    615 12. The illegal pattern /(?(?<E>.*!.*)?)/ was not being diagnosed as missing an
    616 assertion after (?(. The code was failing to check the character after (?(?<
    617 for the ! or = that would indicate a lookbehind assertion. This bug was
    618 discovered by the LLVM fuzzer.
    619 
    620 13. A pattern such as /X((?2)()*+){2}+/ which has a possessive quantifier with
    621 a fixed maximum following a group that contains a subroutine reference was
    622 incorrectly compiled and could trigger buffer overflow. This bug was discovered
    623 by the LLVM fuzzer.
    624 
    625 14. Negative relative recursive references such as (?-7) to non-existent
    626 subpatterns were not being diagnosed and could lead to unpredictable behaviour.
    627 This bug was discovered by the LLVM fuzzer.
    628 
    629 15. The bug fixed in 14 was due to an integer variable that was unsigned when
    630 it should have been signed. Some other "int" variables, having been checked,
    631 have either been changed to uint32_t or commented as "must be signed".
    632 
    633 16. A mutual recursion within a lookbehind assertion such as (?<=((?2))((?1)))
    634 caused a stack overflow instead of the diagnosis of a non-fixed length
    635 lookbehind assertion. This bug was discovered by the LLVM fuzzer.
    636 
    637 17. The use of \K in a positive lookbehind assertion in a non-anchored pattern
    638 (e.g. /(?<=\Ka)/) could make pcre2grep loop.
    639 
    640 18. There was a similar problem to 17 in pcre2test for global matches, though
    641 the code there did catch the loop.
    642 
    643 19. If a greedy quantified \X was preceded by \C in UTF mode (e.g. \C\X*),
    644 and a subsequent item in the pattern caused a non-match, backtracking over the
    645 repeated \X did not stop, but carried on past the start of the subject, causing
    646 reference to random memory and/or a segfault. There were also some other cases
    647 where backtracking after \C could crash. This set of bugs was discovered by the
    648 LLVM fuzzer.
    649 
    650 20. The function for finding the minimum length of a matching string could take
    651 a very long time if mutual recursion was present many times in a pattern, for
    652 example, /((?2){73}(?2))((?1))/. A better mutual recursion detection method has
    653 been implemented. This infelicity was discovered by the LLVM fuzzer.
    654 
    655 21. Implemented PCRE2_NEVER_BACKSLASH_C.
    656 
    657 22. The feature for string replication in pcre2test could read from freed
    658 memory if the replication required a buffer to be extended, and it was not
    659 working properly in 16-bit and 32-bit modes. This issue was discovered by a
    660 fuzzer: see http://lcamtuf.coredump.cx/afl/.
    661 
    662 23. Added the PCRE2_ALT_CIRCUMFLEX option.
    663 
    664 24. Adjust the treatment of \8 and \9 to be the same as the current Perl
    665 behaviour.
    666 
    667 25. Static linking against the PCRE2 library using the pkg-config module was
    668 failing on missing pthread symbols.
    669 
    670 26. If a group that contained a recursive back reference also contained a
    671 forward reference subroutine call followed by a non-forward-reference
    672 subroutine call, for example /.((?2)(?R)\1)()/, pcre2_compile() failed to
    673 compile correct code, leading to undefined behaviour or an internally detected
    674 error. This bug was discovered by the LLVM fuzzer.
    675 
    676 27. Quantification of certain items (e.g. atomic back references) could cause
    677 incorrect code to be compiled when recursive forward references were involved.
    678 For example, in this pattern: /(?1)()((((((\1++))\x85)+)|))/. This bug was
    679 discovered by the LLVM fuzzer.
    680 
    681 28. A repeated conditional group whose condition was a reference by name caused
    682 a buffer overflow if there was more than one group with the given name. This
    683 bug was discovered by the LLVM fuzzer.
    684 
    685 29. A recursive back reference by name within a group that had the same name as
    686 another group caused a buffer overflow. For example: /(?J)(?'d'(?'d'\g{d}))/.
    687 This bug was discovered by the LLVM fuzzer.
    688 
    689 30. A forward reference by name to a group whose number is the same as the
    690 current group, for example in this pattern: /(?|(\k'Pm')|(?'Pm'))/, caused a
    691 buffer overflow at compile time. This bug was discovered by the LLVM fuzzer.
    692 
    693 31. Fix -fsanitize=undefined warnings for left shifts of 1 by 31 (it treats 1
    694 as an int; fixed by writing it as 1u).
    695 
    696 32. Fix pcre2grep compile when -std=c99 is used with gcc, though it still gives
    697 a warning for "fileno" unless -std=gnu99 us used.
    698 
    699 33. A lookbehind assertion within a set of mutually recursive subpatterns could
    700 provoke a buffer overflow. This bug was discovered by the LLVM fuzzer.
    701 
    702 34. Give an error for an empty subpattern name such as (?'').
    703 
    704 35. Make pcre2test give an error if a pattern that follows #forbud_utf contains
    705 \P, \p, or \X.
    706 
    707 36. The way named subpatterns are handled has been refactored. There is now a
    708 pre-pass over the regex which does nothing other than identify named
    709 subpatterns and count the total captures. This means that information about
    710 named patterns is known before the rest of the compile. In particular, it means
    711 that forward references can be checked as they are encountered. Previously, the
    712 code for handling forward references was contorted and led to several errors in
    713 computing the memory requirements for some patterns, leading to buffer
    714 overflows.
    715 
    716 37. There was no check for integer overflow in subroutine calls such as (?123).
    717 
    718 38. The table entry for \l in EBCDIC environments was incorrect, leading to its
    719 being treated as a literal 'l' instead of causing an error.
    720 
    721 39. If a non-capturing group containing a conditional group that could match
    722 an empty string was repeated, it was not identified as matching an empty string
    723 itself. For example: /^(?:(?(1)x|)+)+$()/.
    724 
    725 40. In an EBCDIC environment, pcretest was mishandling the escape sequences
    726 \a and \e in test subject lines.
    727 
    728 41. In an EBCDIC environment, \a in a pattern was converted to the ASCII
    729 instead of the EBCDIC value.
    730 
    731 42. The handling of \c in an EBCDIC environment has been revised so that it is
    732 now compatible with the specification in Perl's perlebcdic page.
    733 
    734 43. Single character repetition in JIT has been improved. 20-30% speedup
    735 was achieved on certain patterns.
    736 
    737 44. The EBCDIC character 0x41 is a non-breaking space, equivalent to 0xa0 in
    738 ASCII/Unicode. This has now been added to the list of characters that are
    739 recognized as white space in EBCDIC.
    740 
    741 45. When PCRE2 was compiled without Unicode support, the use of \p and \P gave
    742 an error (correctly) when used outside a class, but did not give an error
    743 within a class.
    744 
    745 46. \h within a class was incorrectly compiled in EBCDIC environments.
    746 
    747 47. JIT should return with error when the compiled pattern requires
    748 more stack space than the maximum.
    749 
    750 48. Fixed a memory leak in pcre2grep when a locale is set.
    751 
    752 
    753 Version 10.10 06-March-2015
    754 ---------------------------
    755 
    756 1. When a pattern is compiled, it remembers the highest back reference so that
    757 when matching, if the ovector is too small, extra memory can be obtained to
    758 use instead. A conditional subpattern whose condition is a check on a capture
    759 having happened, such as, for example in the pattern /^(?:(a)|b)(?(1)A|B)/, is
    760 another kind of back reference, but it was not setting the highest
    761 backreference number. This mattered only if pcre2_match() was called with an
    762 ovector that was too small to hold the capture, and there was no other kind of
    763 back reference (a situation which is probably quite rare). The effect of the
    764 bug was that the condition was always treated as FALSE when the capture could
    765 not be consulted, leading to a incorrect behaviour by pcre2_match(). This bug
    766 has been fixed.
    767 
    768 2. Functions for serialization and deserialization of sets of compiled patterns
    769 have been added.
    770 
    771 3. The value that is returned by PCRE2_INFO_SIZE has been corrected to remove
    772 excess code units at the end of the data block that may occasionally occur if
    773 the code for calculating the size over-estimates. This change stops the
    774 serialization code copying uninitialized data, to which valgrind objects. The
    775 documentation of PCRE2_INFO_SIZE was incorrect in stating that the size did not
    776 include the general overhead. This has been corrected.
    777 
    778 4. All code units in every slot in the table of group names are now set, again
    779 in order to avoid accessing uninitialized data when serializing.
    780 
    781 5. The (*NO_JIT) feature is implemented.
    782 
    783 6. If a bug that caused pcre2_compile() to use more memory than allocated was
    784 triggered when using valgrind, the code in (3) above passed a stupidly large
    785 value to valgrind. This caused a crash instead of an "internal error" return.
    786 
    787 7. A reference to a duplicated named group (either a back reference or a test
    788 for being set in a conditional) that occurred in a part of the pattern where
    789 PCRE2_DUPNAMES was not set caused the amount of memory needed for the pattern
    790 to be incorrectly calculated, leading to overwriting.
    791 
    792 8. A mutually recursive set of back references such as (\2)(\1) caused a
    793 segfault at compile time (while trying to find the minimum matching length).
    794 The infinite loop is now broken (with the minimum length unset, that is, zero).
    795 
    796 9. If an assertion that was used as a condition was quantified with a minimum
    797 of zero, matching went wrong. In particular, if the whole group had unlimited
    798 repetition and could match an empty string, a segfault was likely. The pattern
    799 (?(?=0)?)+ is an example that caused this. Perl allows assertions to be
    800 quantified, but not if they are being used as conditions, so the above pattern
    801 is faulted by Perl. PCRE2 has now been changed so that it also rejects such
    802 patterns.
    803 
    804 10. The error message for an invalid quantifier has been changed from "nothing
    805 to repeat" to "quantifier does not follow a repeatable item".
    806 
    807 11. If a bad UTF string is compiled with NO_UTF_CHECK, it may succeed, but
    808 scanning the compiled pattern in subsequent auto-possessification can get out
    809 of step and lead to an unknown opcode. Previously this could have caused an
    810 infinite loop. Now it generates an "internal error" error. This is a tidyup,
    811 not a bug fix; passing bad UTF with NO_UTF_CHECK is documented as having an
    812 undefined outcome.
    813 
    814 12. A UTF pattern containing a "not" match of a non-ASCII character and a
    815 subroutine reference could loop at compile time. Example: /[^\xff]((?1))/.
    816 
    817 13. The locale test (RunTest 3) has been upgraded. It now checks that a locale
    818 that is found in the output of "locale -a" can actually be set by pcre2test
    819 before it is accepted. Previously, in an environment where a locale was listed
    820 but would not set (an example does exist), the test would "pass" without
    821 actually doing anything. Also the fr_CA locale has been added to the list of
    822 locales that can be used.
    823 
    824 14. Fixed a bug in pcre2_substitute(). If a replacement string ended in a
    825 capturing group number without parentheses, the last character was incorrectly
    826 literally included at the end of the replacement string.
    827 
    828 15. A possessive capturing group such as (a)*+ with a minimum repeat of zero
    829 failed to allow the zero-repeat case if pcre2_match() was called with an
    830 ovector too small to capture the group.
    831 
    832 16. Improved error message in pcre2test when setting the stack size (-S) fails.
    833 
    834 17. Fixed two bugs in CMakeLists.txt: (1) Some lines had got lost in the
    835 transfer from PCRE1, meaning that CMake configuration failed if "build tests"
    836 was selected. (2) The file src/pcre2_serialize.c had not been added to the list
    837 of PCRE2 sources, which caused a failure to build pcre2test.
    838 
    839 18. Fixed typo in pcre2_serialize.c (DECL instead of DEFN) that causes problems
    840 only on Windows.
    841 
    842 19. Use binary input when reading back saved serialized patterns in pcre2test.
    843 
    844 20. Added RunTest.bat for running the tests under Windows.
    845 
    846 21. "make distclean" was not removing config.h, a file that may be created for
    847 use with CMake.
    848 
    849 22. A pattern such as "((?2){0,1999}())?", which has a group containing a
    850 forward reference repeated a large (but limited) number of times within a
    851 repeated outer group that has a zero minimum quantifier, caused incorrect code
    852 to be compiled, leading to the error "internal error: previously-checked
    853 referenced subpattern not found" when an incorrect memory address was read.
    854 This bug was reported as "heap overflow", discovered by Kai Lu of Fortinet's
    855 FortiGuard Labs. (Added 24-March-2015: CVE-2015-2325 was given to this.)
    856 
    857 23. A pattern such as "((?+1)(\1))/" containing a forward reference subroutine
    858 call within a group that also contained a recursive back reference caused
    859 incorrect code to be compiled. This bug was reported as "heap overflow",
    860 discovered by Kai Lu of Fortinet's FortiGuard Labs. (Added 24-March-2015:
    861 CVE-2015-2326 was given to this.)
    862 
    863 24. Computing the size of the JIT read-only data in advance has been a source
    864 of various issues, and new ones are still appear unfortunately. To fix
    865 existing and future issues, size computation is eliminated from the code,
    866 and replaced by on-demand memory allocation.
    867 
    868 25. A pattern such as /(?i)[A-`]/, where characters in the other case are
    869 adjacent to the end of the range, and the range contained characters with more
    870 than one other case, caused incorrect behaviour when compiled in UTF mode. In
    871 that example, the range a-j was left out of the class.
    872 
    873 
    874 Version 10.00 05-January-2015
    875 -----------------------------
    876 
    877 Version 10.00 is the first release of PCRE2, a revised API for the PCRE
    878 library. Changes prior to 10.00 are logged in the ChangeLog file for the old
    879 API, up to item 20 for release 8.36.
    880 
    881 The code of the library was heavily revised as part of the new API
    882 implementation. Details of each and every modification were not individually
    883 logged. In addition to the API changes, the following changes were made. They
    884 are either new functionality, or bug fixes and other noticeable changes of
    885 behaviour that were implemented after the code had been forked.
    886 
    887 1. Including Unicode support at build time is now enabled by default, but it
    888 can optionally be disabled. It is not enabled by default at run time (no
    889 change).
    890 
    891 2. The test program, now called pcre2test, was re-specified and almost
    892 completely re-written. Its input is not compatible with input for pcretest.
    893 
    894 3. Patterns may start with (*NOTEMPTY) or (*NOTEMPTY_ATSTART) to set the
    895 PCRE2_NOTEMPTY or PCRE2_NOTEMPTY_ATSTART options for every subject line that is
    896 matched by that pattern.
    897 
    898 4. For the benefit of those who use PCRE2 via some other application, that is,
    899 not writing the function calls themselves, it is possible to check the PCRE2
    900 version by matching a pattern such as /(?(VERSION>=10)yes|no)/ against a
    901 string such as "yesno".
    902 
    903 5. There are case-equivalent Unicode characters whose encodings use different
    904 numbers of code units in UTF-8. U+023A and U+2C65 are one example. (It is
    905 theoretically possible for this to happen in UTF-16 too.) If a backreference to
    906 a group containing one of these characters was greedily repeated, and during
    907 the match a backtrack occurred, the subject might be backtracked by the wrong
    908 number of code units. For example, if /^(\x{23a})\1*(.)/ is matched caselessly
    909 (and in UTF-8 mode) against "\x{23a}\x{2c65}\x{2c65}\x{2c65}", group 2 should
    910 capture the final character, which is the three bytes E2, B1, and A5 in UTF-8.
    911 Incorrect backtracking meant that group 2 captured only the last two bytes.
    912 This bug has been fixed; the new code is slower, but it is used only when the
    913 strings matched by the repetition are not all the same length.
    914 
    915 6. A pattern such as /()a/ was not setting the "first character must be 'a'"
    916 information. This applied to any pattern with a group that matched no
    917 characters, for example: /(?:(?=.)|(?<!x))a/.
    918 
    919 7. When an (*ACCEPT) is triggered inside capturing parentheses, it arranges for
    920 those parentheses to be closed with whatever has been captured so far. However,
    921 it was failing to mark any other groups between the highest capture so far and
    922 the currrent group as "unset". Thus, the ovector for those groups contained
    923 whatever was previously there. An example is the pattern /(x)|((*ACCEPT))/ when
    924 matched against "abcd".
    925 
    926 8. The pcre2_substitute() function has been implemented.
    927 
    928 9. If an assertion used as a condition was quantified with a minimum of zero
    929 (an odd thing to do, but it happened), SIGSEGV or other misbehaviour could
    930 occur.
    931 
    932 10. The PCRE2_NO_DOTSTAR_ANCHOR option has been implemented.
    933 
    934 ****
    935