ChangeLog 129 KB

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