Commit Graph

93 Commits

Author SHA1 Message Date
Philip Hazel f65df06305 Remove unused enum; add comments re unity builds 2022-04-24 16:44:33 +01:00
pkeir a13d7d4340
Added support for (CMake) Unity Builds. (#94) 2022-04-24 16:37:37 +01:00
Zoltan Herczeg e21345de97
Extend unicode boolean property bitset index to 12 bit (#81)
Co-authored-by: Zoltan Herczeg <hzmester@freemail.hu>
2022-01-14 15:51:03 +00:00
Zoltan Herczeg 061e57695a
Merge scriptx and bidi fields (#78)
Co-authored-by: Zoltan Herczeg <hzmester@freemail.hu>
2022-01-12 17:00:12 +00:00
Philip Hazel 636569a957 Initial code for Boolean property support 2022-01-09 14:46:43 +00:00
Zoltan Herczeg afa4756d19
Rework script extension handling (#64)
Co-authored-by: Zoltan Herczeg <hzmester@freemail.hu>
2021-12-29 09:35:22 +00:00
Philip Hazel b29732063b Revised script handling (see ChangeLog) 2021-12-21 16:11:30 +00:00
Philip Hazel 0246c6bf64 Add support for Bidi_Control and Bidi_Class properties 2021-12-08 15:34:27 +00:00
Philip Hazel 4ef0c51d2b Interpret NULL pointer, zero length as an empty string for subjects and replacements. 2021-11-30 16:34:39 +00:00
Carlo Marcelo Arenas Belón ae4e6261e5
match: avoid crash if subject NULL and PCRE2_ZERO_TERMINATED (#53)
* pcre2_match: avoid crash if subject NULL and PCRE2_ZERO_TERMINATED

When length of subject is PCRE2_ZERO_TERMINATED strlen is used
to calculate its size, which will trigger a crash if subject is
also NULL.

Move the NULL check before strlen on it would be used, and make
sure or dependent variables are set after the NULL validation
as well.

While at it, fix a typo in a debug flag in the same file, which
is otherwise unrelated and make sure the full section of constrain
checks can be identified clearly using the leading comment alone.

* pcre2_dfa_match: avoid crash if subject NULL and PCRE2_ZERO_TERMINATED

When length of subject is PCRE2_ZERO_TERMINATED strlen is used
to calculate its size, which will trigger a crash if subject is
also NULL.

Move the NULL check before the detection for subject sizes to
avoid this issue.

* pcre2_substitute: avoid crash if subject or replacement are NULL

The underlying pcre2_match() function will validate the subject if
needed, but will crash when length is PCRE2_ZERO_TERMINATED or if
subject == NULL and pcre2_match() is not being called because
match_data was provided.

The replacement parameter is missing NULL checks, and so currently
allows for an equivalent response to "" if rlength == 0.

Restrict all other cases to avoid strlen(NULL) crashes in the same
way that is done for subject, but also make sure to reject invalid
length values as early as possible.
2021-11-27 16:49:31 +00:00
Philip Hazel 8f3e11a355 Doc file tidies for 10.38-RC1 2021-08-31 17:14:42 +01:00
Philip Hazel eea410b33a Improve code for "starts with" optimization in the interpreters. 2021-08-29 17:25:59 +01:00
Philip.Hazel 8b3f8af535 File tidies for 10.35-RC1 release candidate. 2020-04-15 16:34:36 +00:00
Philip.Hazel 4a7dfab0ec Unicode upper/lower casing is now used when UCP is set, even if UTF is not set.
This is not yet documented, and it not yet implemented in JIT.
2020-02-23 16:40:05 +00:00
Philip.Hazel ae9208ab7b Source tidies (trailing spaces) etc. for 10.34-RC1. 2019-10-17 16:39:38 +00:00
Philip.Hazel 7bbdc58513 Fix pessimizing optimization of start-of-match code units in the interpreters. 2019-09-06 16:08:45 +00:00
Philip.Hazel 3572634086 More partial match tweaks. 2019-07-22 16:30:44 +00:00
Philip.Hazel c84a06c96e Update definition of partial match and fix \z and \Z (as documented). 2019-07-21 16:48:13 +00:00
Philip.Hazel 620f3a1307 Implement non-atomic positive assertions. 2019-07-13 11:12:03 +00:00
Philip.Hazel c0d0ee5365 Fix partial matching bug in pcre2_dfa_match(). 2019-06-26 16:13:28 +00:00
Philip.Hazel d5dc4e0c33 Tweak limits on "must have" code unit searches (improves some performance). 2019-05-28 16:34:28 +00:00
Philip.Hazel 16c046ce50 Implement support for invalid UTF in the pcre2_match() interpreter. 2019-05-24 17:15:48 +00:00
Philip.Hazel 95c9d011e3 Change a number of expressions like 1<<10 to 1u<<10. 2019-04-12 14:40:27 +00:00
Philip.Hazel 51fb3956ee Update copyright date 2019-01-30 16:10:38 +00:00
Philip.Hazel 86349f8814 Fix bug in VERSION conditional test in DFA matching. 2019-01-29 14:34:59 +00:00
Philip.Hazel 9938684b7b Cast to get rid of compiler warning. 2018-12-14 16:02:29 +00:00
Philip.Hazel 951bc4b9ff Fix heap limit checking overflow bug in pcre2_dfa_match(). 2018-10-22 16:47:55 +00:00
Philip.Hazel 8a0dd8955a Set subject field in match data to NULL after failed match. 2018-10-19 15:31:16 +00:00
Philip.Hazel f90ce1a333 Implement PCRE2_COPY_MATCHED_SUBJECT. 2018-10-17 08:33:38 +00:00
Philip.Hazel 866750fd53 Basic "script run" implementation. Not yet complete, and not yet documented. 2018-10-02 15:25:58 +00:00
Philip.Hazel 1a8cc3dab6 Make bcopy() emulation of memmove() work properly. 2018-08-10 16:27:44 +00:00
Philip.Hazel 192b82cf6e Allow :NAME on (*ACCEPT), (*FAIL), and (*COMMIT) and fix bug with (*MARK)
followed by (*ACCEPT) in an assertion. More small updates to perltest.sh.
2018-07-21 14:34:51 +00:00
Philip.Hazel e75410a5d8 More typos and changes to "Kibibytes" for "Kilobytes". 2018-06-18 14:03:33 +00:00
Philip.Hazel fabea723cf Typos in documentation and comments noted by Jason Hood. 2018-06-17 14:13:28 +00:00
Philip.Hazel 75747ebb11 Re-factor pcre2_dfa_match() to use the heap instead of the stack for workspace
vectors when doing recursive function calls.
2018-04-27 16:48:35 +00:00
Philip.Hazel fb413521fc Minor code tidy. 2018-04-21 16:43:49 +00:00
Philip.Hazel 958cd1484f Source tidies and version etc. updates for 10.31-RC1. 2018-01-13 16:53:02 +00:00
Philip.Hazel 85f8ecba58 Tidy ACROSSCHAR macro to take same form as FORWARDCHAR and BACKCHAR. 2018-01-01 15:13:24 +00:00
Philip.Hazel 4048606896 Small tidy to start of match optimizations. 2018-01-01 15:05:27 +00:00
Philip.Hazel 807f37095d Previous FIRSTLINE patch was broken. Fix it. 2018-01-01 14:54:06 +00:00
Philip.Hazel 7a6e8a4454 Fix PCRE2_FIRSTLINE bug when a pattern match starts with the first code unit of
a newline sequence.
2018-01-01 14:12:35 +00:00
Philip.Hazel f36a3235bc Tidy up callout code in pcre2_dfa_match(). 2017-12-26 16:43:45 +00:00
Philip.Hazel 94d5f4a050 Add callout_flags to callout blocks, and set bits within it from pcre2_match()
interpretation.
2017-12-22 15:56:27 +00:00
Philip.Hazel 2881730084 Very minor code tidy. 2017-11-16 17:44:50 +00:00
Philip.Hazel 42f547bf4d Replace multiple copies of extended grapheme sequence code with a single
subroutine.
2017-09-12 16:28:42 +00:00
Philip.Hazel 4f7a608d56 Update grapheme breaking rules for Unicode 10.0.0. 2017-07-05 08:55:49 +00:00
Philip.Hazel b7d5cee61f Allow anchored patterns to use "first code unit" optimization. 2017-06-30 16:00:33 +00:00
Philip.Hazel f850015168 Add suitable "fall through" comments for latest gcc warnings. 2017-06-03 17:50:03 +00:00
Philip.Hazel c0902e176f Make pcre2_dfa_match() take notice of the match limit, to catch patterns that
use too much resource. This should fix oss-fuzz 1761.
2017-05-30 10:42:57 +00:00
Philip.Hazel 3f96e07e6b Fix lookbehind with zero-length branch in DFA matching. Fixes oss-fuzz 1959. 2017-05-27 15:49:29 +00:00