Commit Graph

717 Commits

Author SHA1 Message Date
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
Zoltán Herczeg a16919ce6f Improve character range optimization in JIT. 2017-05-30 09:42:28 +00:00
Philip.Hazel cfe289c60b Fix pcre2test buffer size issue for convert calls in non-8-bit modes. 2017-05-29 16:21:11 +00:00
Zoltán Herczeg 3f831482ab Fix alnum parsing in glob conversion. 2017-05-28 04:05:58 +00:00
Zoltán Herczeg b317bdc184 JIT SSE2 optimization improvement. 2017-05-28 03:53:09 +00:00
Philip.Hazel c34544b11f Update POSIX basic regex conversion code. 2017-05-27 17:08:28 +00:00
Philip.Hazel 62e202f757 Discard partial match when endanchored is set in the fuzzer, as it just gives
an immediate bad options return.
2017-05-27 16:06:56 +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
Philip.Hazel 3d80fa4fc2 Implement PCRE2_NEWLINE_NUL. 2017-05-26 17:14:36 +00:00
Philip.Hazel 772d857f69 More conversion development. 2017-05-25 16:34:22 +00:00
Zoltán Herczeg bf6f53b089 Support invalid character classes in conversion. 2017-05-25 13:19:42 +00:00
Zoltán Herczeg 0b2052f714 Support the general case of starstar in glob conversion. 2017-05-24 15:22:03 +00:00
Zoltán Herczeg 9826db624e Rework character range parsing in glob conversion. 2017-05-24 10:14:43 +00:00
Philip.Hazel fef4de56a1 Fix potential NULL dereference in new code for surrogate escapes, discovered by
Coverity Scan.
2017-05-23 16:47:29 +00:00
Philip.Hazel 231a800557 More experimental convert code evolution. 2017-05-23 16:08:48 +00:00
Zoltán Herczeg 51df11a591 Use atomic blocks after starstar during conversion. 2017-05-23 15:17:44 +00:00
Philip.Hazel 0e622185c2 Screw down the depth limit for DFA matching in the fuzzer function. Fixes
OSS-fuzz 1761 (I hope).
2017-05-22 18:06:55 +00:00
Zoltán Herczeg e36e582af0 Implement flags in the glob convert functions. 2017-05-22 10:23:36 +00:00
Philip.Hazel 72f0c742dd Add a call to pcre2_dfa_match() to the fuzzer driver. 2017-05-20 14:28:11 +00:00
Philip.Hazel 62564c08fd pcre2test can now handle lists of conversion options. 2017-05-20 11:40:12 +00:00
Zoltán Herczeg 095924ee65 Implement starstar in glob conversion. 2017-05-19 03:55:39 +00:00
Philip.Hazel 485b269f9c Conversion code update (revised option definitions). 2017-05-18 14:42:19 +00:00
Zoltán Herczeg ac12e979b3 Support character classes in glob conversion. 2017-05-18 06:46:22 +00:00
Philip.Hazel dfc9712bcd Add additional compile options and PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES. 2017-05-17 17:55:11 +00:00
Zoltán Herczeg d9c33d0708 Reworking bash glob conversion. 2017-05-17 13:44:24 +00:00
Philip.Hazel 223104001c Get rid of literal strings in conversion functions. 2017-05-16 12:42:17 +00:00
Zoltán Herczeg dcbba52985 Initial version of bash glob conversion. 2017-05-16 07:14:11 +00:00
Philip.Hazel f8256af661 Experimental conversion: fix POSIX BRE starting ^*. 2017-05-14 12:04:13 +00:00
Philip.Hazel 7927ac0ee3 Updates to experimental conversion code. 2017-05-13 17:46:27 +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 ab1e3c9309 Refactor to avoid sanitize warnings when accessing the variable size ovector in
the backtracking frame. Fixes oss-fuzz issue 1465. Also make -bigstack in 
RunTest allocate a 64Mb stack for use with clang sanitizing.
2017-05-10 18:21:03 +00:00
Philip.Hazel 1909bf0691 Refactor to avoid picky compiler warnings. Fixes oss-fuzz issue 1454. 2017-05-10 16:44:33 +00:00
Philip.Hazel 3813b518ce Correct fix for experimental POSIX pattern translation. 2017-05-10 15:42:13 +00:00
Philip.Hazel 7ca875b1db Fix bug in experimental conversion code. 2017-05-09 10:44:50 +00:00
Zoltán Herczeg 660811e899 Improve first bitset search in JIT. 2017-05-09 08:42:46 +00:00
Philip.Hazel 764e23e670 Fix typos in macros for experimental convert functions. 2017-05-08 15:07:34 +00:00
Zoltán Herczeg 4655d89ce5 Continue reworking first character search in JIT. 2017-05-08 13:32:59 +00:00
Zoltán Herczeg 3c542db175 Improve first character searches. 2017-05-08 03:35:40 +00:00
Philip.Hazel 587011e326 Fix memory leak in pcre2test (found by Coverity Scan). 2017-05-07 15:55:41 +00:00
Zoltán Herczeg ba1c759c90 JIT: Allow early quit in fast forward search. 2017-05-07 14:28:37 +00:00
Zoltán Herczeg a61bd956eb JIT compiler update. 2017-05-07 07:10:16 +00:00
Philip.Hazel 382b64b01c Fix crash when more than one kind of "push" was set in pcre2test. 2017-05-06 16:56:07 +00:00
Philip.Hazel 6e943e5f47 Experimental pattern conversion code (no public documentation yet). 2017-05-06 16:19:39 +00:00
Zoltán Herczeg aa224e4ac9 JIT compielr update. 2017-04-26 08:34:09 +00:00
Philip.Hazel b3a6fd38b8 Tidy comments about UTF case-independence. 2017-04-20 16:51:36 +00:00
Philip.Hazel 369d82e03a Implement Perl's /n option, which is the same as PCRE2_NO_AUTO_CAPTURE. 2017-04-18 16:21:50 +00:00
Zoltán Herczeg 584f35c059 Improve prefix character scanning in JIT. 2017-04-18 14:37:01 +00:00
Philip.Hazel 3dca43fdff Implement PCRE2_EXTENDED_MORE and friends. 2017-04-18 12:32:52 +00:00
Zoltán Herczeg b9f95b5f63 Refactor SSE2 accelerated first character search in JIT. 2017-04-18 05:49:39 +00:00
Zoltán Herczeg 486a66681f SSE2 accelerated first character pair search in JIT. 2017-04-17 14:54:04 +00:00
Philip.Hazel 41d1c6d6ce Tidies and minor bug fix resulting from Coverity Scan issues. 2017-04-16 16:49:11 +00:00
Philip.Hazel 202cb2cf41 Improve testing coverage with updates to pcre2test and test files; also get rid
of redundant code in pcre2_match().
2017-04-16 13:03:30 +00:00
Philip.Hazel 106028089e Ensure ovector[0,1] are both PCRE2_UNSET during callouts. 2017-04-14 12:39:41 +00:00
Philip.Hazel e8cdae3c5b Correct an incorrect cast. 2017-04-14 12:14:41 +00:00
Philip.Hazel b35a98c403 Remove duplication typo. 2017-04-14 12:08:54 +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 346447005a Remove redundant line of code (a typo really). 2017-04-14 11:42:02 +00:00
Zoltán Herczeg 1379a48d94 Support end anchored in JIT. 2017-04-13 11:52:36 +00:00
Philip.Hazel bd511d381f Fix valgrind warnings for unset padding at the end of the pcre2_real_code
structure.
2017-04-12 13:48:11 +00:00
Philip.Hazel b3154eb907 Tidy some confusing code. 2017-04-12 13:26:11 +00:00
Philip.Hazel 3b8672bf49 Fix ACCEPT issue with ENDANCHORED. 2017-04-11 14:53:26 +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 f0126dc7ae Add -jitverify to pcre2test. 2017-04-08 15:35:27 +00:00
Philip.Hazel 7afe4e4110 Documentation tidies and code tidies for Windows. 2017-04-08 15:21:39 +00:00
Zoltán Herczeg 13c0ea59b2 Enabling valgrind disables SSE2 in JIT. 2017-04-07 11:06:56 +00:00
Philip.Hazel 09f87cbfce Extend auto-anchoring to ignore "never-obeyed" groups at the start. 2017-04-07 08:46:29 +00:00
Philip.Hazel 88abc14e42 Jason Hood's pcre2grep patches (modified a bit) to add --output to pcre2grep,
and also an inbuilt callout echo.
2017-04-06 18:02:40 +00:00
Philip.Hazel 2b36600b2b Fix typo and remove extraneous blank lines. 2017-04-05 15:40:06 +00:00
Philip.Hazel a3275d1e0f Implement PCRE2_ENDANCHORED. 2017-04-04 17:09:33 +00:00
Philip.Hazel 0757041114 Fix non-passing of mark values out of recursions. 2017-04-04 11:37:21 +00:00
Philip.Hazel fcd0c39b26 Fix capturing in conditional negative assertions ended with (*ACCEPT). 2017-04-03 18:02:07 +00:00
Zoltán Herczeg c37995d2bd JIT compiler update. 2017-04-03 13:30:17 +00:00
Philip.Hazel a073581116 Fix buglet in recent update for showing malloc/free at match time. 2017-03-31 15:51:41 +00:00
Zoltán Herczeg bdac9df4cf Fix character type detection when 32-bit and UCP are enabled but UTF is not in JIT. 2017-03-31 05:40:37 +00:00
Zoltán Herczeg a5da70b28c Support (*ACCEPT) inside recurse in JIT. 2017-03-30 13:25:20 +00:00
Zoltán Herczeg 380738d981 Improve callouts and revertframes in JIT. 2017-03-29 08:12:32 +00:00
Zoltán Herczeg 447d1b3083 Minor JIT compiler update. 2017-03-28 09:56:52 +00:00
Zoltán Herczeg a31b57c9da Reverse the jit-stack to top-down. 2017-03-27 13:35:08 +00:00
Philip.Hazel a695d6425d Better error handling in pcre2test. 2017-03-26 17:51:31 +00:00
Philip.Hazel 08543d4a74 Improvements to the \=memory modifier in pcre2test. 2017-03-25 17:08:20 +00:00
Philip.Hazel 649ae8f6d5 Fix bug introduced at 10.21: use memory allocator from the pattern if no
context is supplied to pcre2_match().
2017-03-25 15:19:49 +00:00
Zoltán Herczeg 25cec7a966 Support full ovector data for JIT callouts. 2017-03-25 06:33:41 +00:00
Philip.Hazel 5c1984d94a Make \=find_limits apply to DFA matching, to find the minimum depth limit. 2017-03-24 18:20:34 +00:00
Philip.Hazel 45ddeb70cf Fix issues with (*VERB)s inside recursive subroutine calls. 2017-03-23 17:54:58 +00:00
Philip.Hazel d5ca2dee9d Fix misbehaving DFA match for possessively repeated character class (Bugzilla
2086).
2017-03-22 15:12:06 +00:00
Philip.Hazel de307ea031 Previous patch was not quite complete. 2017-03-21 18:36:13 +00:00
Philip.Hazel cde5f12cee Fix 32-bit error buffer size bug in pcre2test (Bugzilla 2079). 2017-03-21 17:46:21 +00:00
Philip.Hazel a122f42abf Fix NULL deference if pcre2_callout_enumerate() is called with a NULL pattern
when Unicode support is available (Bugzilla 2076).
2017-03-21 16:31:54 +00:00
Philip.Hazel e105a0f83f Fix memory leak when deserializing invalid data (Bugzilla 2075). 2017-03-21 16:25:01 +00:00
Philip.Hazel 8e4eb8dbc8 Close serialization file in pcre2test after any error. 2017-03-21 16:18:54 +00:00
Philip.Hazel ca75518017 Fix pcre2grep Windows problem for new output-colouring code when not under
mingw (Bugzilla 2067).
2017-03-21 16:09:57 +00:00
Philip.Hazel 31455a7665 Minor pcre2test code fix for framesize modifier and documentation update. 2017-03-21 12:22:58 +00:00
Zoltán Herczeg 131209e22d Capture control verbs inside the conditional assertion of a conditional block. 2017-03-20 10:41:13 +00:00
Philip.Hazel d6faa55b91 Fix pcre2test bug for global match with zero terminated subject. 2017-03-19 18:34:27 +00:00
Zoltán Herczeg b55ef12cc1 Reworked the recursive pattern matching in the JIT compiler to follow the interpreter changes. 2017-03-19 03:35:27 +00:00
Philip.Hazel b6b716b540 Update generic files. 2017-03-17 16:55:47 +00:00
Philip.Hazel ae37c6e886 Add "framesize" to pcre2test to display pcre2_match() frame size, using the new
PCRE2_INFO_FRAMESIZE option for pcre2_pattern_info().
2017-03-16 17:55:55 +00:00
Philip.Hazel d7da2dcb37 Fix crash for forward reference in lookbehind with PCRE2_ANCHORED. Fixes
oss-fuzz issue 865.
2017-03-16 17:17:47 +00:00
Philip.Hazel be5dd257d2 Add cast to avoid compiler warning. 2017-03-14 16:46:08 +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 04da0725f3 Remove obsolete OP_ONCE_NC internal opcode. 2017-03-11 17:59:23 +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 26e92bc554 Fix crash for pattern with very many captures. Fixes oss-fuzz issue 783. 2017-03-10 16:34:54 +00:00
Philip.Hazel 143c136ac6 Fix oss-fuzz issue 781: read from bad memory when fewer capturing parens than
space in the external ovector.
2017-03-10 15:53:49 +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 53bf29d689 Fix 32-bit non-UTF property test crash. 2017-02-24 18:25:32 +00:00
Philip.Hazel f6f7c9148f Check malloc returns in pcre2test. 2017-02-23 17:05:43 +00:00
Zoltán Herczeg 9669cd1218 Major JIT compiler update. 2017-02-15 07:27:08 +00:00
Philip.Hazel bea3a10a93 Final file updates for 10.23. 2017-02-14 10:40:33 +00:00
Philip.Hazel 388ffac596 Fix bug in most recent fix for pcre2grep. 2017-02-12 13:30:38 +00:00
Philip.Hazel 0299bba9d9 Fix previously broken fix for pcre2grep with -Mo matching strings that cross
line boundaries.
2017-02-10 17:39:29 +00:00
Philip.Hazel 8a3a452ea9 Small code tidy to make it more understandable. 2017-02-10 16:42:14 +00:00
Philip.Hazel 3fb194afa4 Cache group minima to speed up studying of pathological patterns. Fixes
oss-fuzz #557.
2017-02-10 16:33:15 +00:00
Philip.Hazel 7ab91fdfb2 Reduce recursion limit for auto-possessify to reduce stack usage at compile
time. Fixes oss-fuzz issue 553.
2017-02-08 17:03:30 +00:00
Philip.Hazel 2f1e99e04f Don't use %td (use %lu instead) in pcre2test under MSVC. 2017-02-04 16:27:20 +00:00
Philip.Hazel 4311f49d0e Fix \g+ bug when the number that follows is too big. 2017-01-31 17:15:30 +00:00
Philip.Hazel 56a8ada12d Fix warnings in 32-bit environments. 2017-01-17 15:21:11 +00:00
Philip.Hazel ca1ecd41a1 File tidies for 10.23-RC1 2017-01-16 17:40:47 +00:00
Philip.Hazel 31c62034fe Minor tidies to pcre2grep. 2017-01-16 15:06:57 +00:00
Philip.Hazel 662a765bdf Update build system for changes in the JIT modules. 2017-01-12 16:35:43 +00:00
Zoltán Herczeg 88c0f14825 JIT compiler update. Patch insipred by Christian Persch. 2017-01-12 09:32:15 +00:00
Philip.Hazel 224e707ab0 Ignore all JIT compile errors in pcre2grep. 2017-01-11 17:10:28 +00:00
Philip.Hazel 6332aa1101 Fix pcre2test mishandling "end before start" return with POSIX interface. 2017-01-11 17:02:27 +00:00
Philip.Hazel 1226e2e0d0 Fix hyphen after \E after POSIX class causing an error. 2017-01-11 16:40:35 +00:00
Zoltán Herczeg 27eab0b836 JIT compiler update. 2017-01-05 10:01:29 +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 15c30bf55a Detect overlong patterns earlier. 2017-01-03 11:35:26 +00:00
Zoltán Herczeg e22fadd1e4 JIT compiler update. 2017-01-02 13:01:42 +00:00
Philip.Hazel 5a15ad5c36 Fix very minor typo. 2017-01-01 12:13:17 +00:00
Philip.Hazel 396a7c7d29 Upgrade pcre2grep for Windows courtesy of Jason Hood. 2016-12-31 17:40:45 +00:00
Philip.Hazel 70daa788a5 Minor tidy. 2016-12-31 14:17:14 +00:00
Philip.Hazel f42fb677b9 Limit the subject length in the fuzzer support function, to avoid wasting time
searching large trees.
2016-12-31 13:46:36 +00:00
Philip.Hazel 18dd19eae0 Make the test for over-complication while auto-possessifying bite sooner. 2016-12-31 13:35:31 +00:00
Philip.Hazel 25dbe146bd Very minor tidy to pcre2grep, plus fix typos in comments. 2016-12-29 16:29:05 +00:00
Philip.Hazel 62659dd2f3 Add callout_error to pcre2test and stop the fuzzer after 100 callouts. 2016-12-28 15:05:48 +00:00
Philip.Hazel f676362977 Fix issue with \Q\E after a callout before an assertion condition. 2016-12-28 12:26:12 +00:00
Philip.Hazel fdf7946ee0 Fail hyphen after POSIX character class. 2016-12-27 11:50:28 +00:00
Philip.Hazel 8933d999d8 Fix class bug when UCP but not UTF was set and all wide characters need to be
included.
2016-12-26 17:11:18 +00:00
Philip.Hazel a7a25ed91d Fix bug when a character > 0xffff appears in a lookbehind within a lookbehind. 2016-12-24 16:25:11 +00:00
Philip.Hazel 6c48775955 Fix mis-parsing of a conditional group with callout but a question mark where
the assertion should start.
2016-12-23 18:34:10 +00:00
Philip.Hazel 482b6a1f0a Add the -ac option (auto_callout) to pcre2test. 2016-12-23 17:36:22 +00:00
Philip.Hazel d15aab4d17 More refactoring: keep track of empty branches during compiling, replacing a
post-compile scan.
2016-12-23 17:09:37 +00:00
Philip.Hazel 1f87b60f01 Make the recursion limit apply to DFA matching. 2016-12-23 11:04:51 +00:00
Philip.Hazel 3df9674c4e Fix name table sort buffer overflow. 2016-12-21 17:09:11 +00:00
Philip.Hazel dfff2fbc9f Limit the fuzzing function with match limit = recursion limit = 100. 2016-12-20 17:10:30 +00:00
Philip.Hazel a984029d80 Fix incorrect internal error for very complicated back reference handling. 2016-12-20 16:47:41 +00:00
Philip.Hazel f77339a3ca Fix \Q\E quantification bug. 2016-12-11 16:42:29 +00:00
Philip.Hazel a98121a212 Fix caseless minimizing back reference bug when heap in use for recursion. 2016-12-10 14:59:24 +00:00
Philip.Hazel 7914fa82a9 Fix OOB error in substitute with start offset longer than length. 2016-12-09 18:19:38 +00:00