ChangeLog 139 KB

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