github的一些开源项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3097 lines
141 KiB

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