Commit Graph

85 Commits

Author SHA1 Message Date
Philip Hazel d90fb23878 Refactor match_data() to always use the heap instead of having an initial frames vector on the stack; some consequential adjustmentsneeded. 2022-07-27 17:44:55 +01:00
Jessica Clarke 04ecb267c0
match: Properly align heapframes for CHERI/Arm's Morello prototype (#72)
On CHERI, and thus Arm's Morello prototype, pointers are represented as
hardware capabilities, which consist of both an integer address and
additional metadata, meaning they are twice the size of the platform's
size_t type, i.e. 16 bytes on a 64-bit system. The ovector member of
heapframe happens to only be 8 byte aligned, and so computing frame_size
ends up with a multiple of 8 but not 16. Whilst the first frame is
always suitably aligned, this then misaligns the frame that follows it,
resulting in an alignment fault when storing a pointer to Fecode at the
start of match.

Thus, round up frame_size to a multiple of heapframe's alignment to
ensure alignment is preserved. This can be completely optimised away on
traditional architectures and, since CHERI's capabilities are in fact
2 * sizeof(PCRE2_SIZE) bytes in size, the variable part of the
expression is also proven to be a multiple of the alignment and so the
aligning gets folded into the offsetof part by adding an additional 8,
so no dynamic alignment code is needed even on CHERI architectures.
2022-01-04 17:06:14 +00:00
Philip Hazel 1c41a5b815 Fix minor issues raised by Clang sanitize 2021-12-14 15:52:24 +00:00
Carlo Marcelo Arenas Belón 587b94277b
doc: formatting/typo fixes to documentation (#47)
* doc: fix incorrect use of JOIN and typo

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>

* doc: reformat of pcre2_substitute to align options

includes some rewording to fit better in an 80 char wide troff output.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>

* doc: update names to pcre2
2021-11-27 16:27:49 +00:00
Philip.Hazel ae9208ab7b Source tidies (trailing spaces) etc. for 10.34-RC1. 2019-10-17 16:39:38 +00:00
Philip.Hazel 78fae97f6c Mend bug introduced in previous patch. Fixes crash detected by ClusterFuzz
17101.
2019-09-10 13:22:08 +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 16c046ce50 Implement support for invalid UTF in the pcre2_match() interpreter. 2019-05-24 17:15:48 +00:00
Philip.Hazel 9bc81d5229 Upgrade the as yet unreleased substitute callout facility. 2018-11-12 16:02:01 +00:00
Philip.Hazel f90ce1a333 Implement PCRE2_COPY_MATCHED_SUBJECT. 2018-10-17 08:33:38 +00:00
Philip.Hazel a69267246f Implement callouts from pcre2_substitute(). 2018-09-18 16:31:30 +00:00
Philip.Hazel 392974a0cb File tidies and documentation update for 10.32-RC1 Release Candidate. 2018-08-13 11:57:09 +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 26edb6cb43 Minor tweak to the m68k patch. 2018-02-28 09:03:12 +00:00
Philip.Hazel dbb53b3585 Add alignment patch for m68k. 2018-02-27 17:19:51 +00:00
Philip.Hazel 7a5b962509 Increment dummy ovector size in internal structures to avoid spurious array
bound checker warnings. This fixes oss-fuzz 5415.
2018-01-16 16:50:40 +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 f36a3235bc Tidy up callout code in pcre2_dfa_match(). 2017-12-26 16:43:45 +00:00
Philip.Hazel 814cc96bc5 Save extra compile options with the compiled pattern, and add an info call to
retrieve them.
2017-12-16 17:49:26 +00:00
Philip.Hazel 5cbab74c97 Rejig how callout blocks are allocated in pcre2_match(). 2017-12-16 16:43:47 +00:00
Philip.Hazel 36366914f5 Fix oss-fuzz bugs 3852 and 3891 (same bug); mis-closing external captures by
*ACCEPT inside assertions.
2017-10-29 16:58:38 +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 231a800557 More experimental convert code evolution. 2017-05-23 16:08:48 +00:00
Philip.Hazel dfc9712bcd Add additional compile options and PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES. 2017-05-17 17:55:11 +00:00
Philip.Hazel 67995268cf More refactoring for ovector addressing. 2017-05-11 16:49:58 +00:00
Philip.Hazel cd4a219626 A better fix for oss-fuzz 1465. 2017-05-11 16:28:54 +00:00
Philip.Hazel 6e943e5f47 Experimental pattern conversion code (no public documentation yet). 2017-05-06 16:19:39 +00:00
Philip.Hazel b38c2aaebd Adjust two match frame variables to save space in 8-bit mode. 2017-04-14 12:02:40 +00:00
Philip.Hazel 14989bd454 Add explicit heap limiting options to pcre2_match(), with associated features
for listing, configuring, etc.
2017-04-11 11:47:25 +00:00
Philip.Hazel 45ddeb70cf Fix issues with (*VERB)s inside recursive subroutine calls. 2017-03-23 17:54:58 +00:00
Philip.Hazel 88db1be123 Change "limit recursion" to "limit depth" in code and build systems because the
old name, which is retained as a synonym for the moment, is no longer 
appropriate.
2017-03-12 13:47:01 +00:00
Philip.Hazel 02779c9a67 Remove remaining (now unused) code under HEAP_MATCH_RECURSE, and make the build
systems give a warning of the obsolescence of --disable-stack-for-recursion and 
the equivalent CMake setting.
2017-03-11 17:39:02 +00:00
Philip.Hazel 20804215a8 Code for new interpreter (build system and documentation still to be done). 2017-03-09 16:23:28 +00:00
Philip.Hazel ca1ecd41a1 File tidies for 10.23-RC1 2017-01-16 17:40:47 +00:00
Philip.Hazel 255bc030d9 Improve class handling for \H and \V by ignoring caseless. 2017-01-03 18:17:31 +00:00
Philip.Hazel 1f87b60f01 Make the recursion limit apply to DFA matching. 2016-12-23 11:04:51 +00:00
Philip.Hazel 270eaa7615 Fix bad working space size calculation when PCRE2_AUTO_CALLOUT is set. 2016-11-04 16:35:47 +00:00
Philip.Hazel 8eae402315 Fix bad lookup in global table for wide characters in extended mode and in
*VERB names.
2016-10-27 17:42:14 +00:00
Philip.Hazel fe965353e6 Insert missing casts to reduce compiler warnings. 2016-10-06 16:47:56 +00:00
Philip.Hazel 99264dfc23 Major refactoring of pcre2_compile.c; see ChangeLog and HACKING. 2016-10-02 16:01:01 +00:00
Philip.Hazel c28ed7fd4a Fix some picky compiler warnings 2016-02-16 10:23:06 +00:00
Philip.Hazel bebd2d48bf Final file updates for 10.21 release. 2016-01-12 14:44:34 +00:00
Philip.Hazel dffd559601 File tidies, version updates, etc. for 10.21-RC1 2015-12-17 18:44:06 +00:00
Philip.Hazel 89b1ae1c98 Use caching to improve could_be_empty() and find_fixed_length() compile times,
especially when recursion/subroutine calls are present.
2015-11-08 14:20:09 +00:00
Philip.Hazel b7ee0684e3 Implement pcre2_set_max_pattern_length() 2015-11-05 17:33:39 +00:00
Philip.Hazel 75181cca2e Give error for overlong lookbehind assertion. 2015-11-03 10:39:27 +00:00
Philip.Hazel 94eda7669a Fix UCP with [[:<]] and [[:>:]] bad compile bug. 2015-10-21 11:29:07 +00:00
Philip.Hazel 836fbb1148 Fix erroneous "\ at end of pattern" errors, introduced by
PCRE2_SUBSTITUTE_EXTENDED patch.
2015-10-17 18:29:01 +00:00