From: Salvatore Bonaccorso Date: Mon, 28 Sep 2026 14:07:53 +0000 (+0200) Subject: pcre2 (10.46-1~deb13u3) trixie-security; urgency=high X-Git-Tag: archive/raspbian/10.46-1_deb13u3+rpi1^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f388191447baabf0102b9124b82ce0ca773fc611;p=pcre2.git pcre2 (10.46-1~deb13u3) trixie-security; urgency=high * Non-maintainer upload by the Security Team. * GHSA-r9hj-j2rw-4q3m: Fix large JIT stack allocation (Closes: #1149217) * For release, revert platform-specific test case [dgit import package pcre2 10.46-1~deb13u3] --- diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000..8c23e75 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,12 @@ + PCRE2 for Debian + ---------------- + +This is PCRE2, the newer version of the PCRE (perl-compatible regular +expression) library. New projects should use this library in +preference the older PCRE library (which is, for historical reasons, +called pcre3 in Debian). + +The names of functions in libpcre2-posix are prefixed with PCRE2_, so +they don't clash with the names in libc. + + -- Matthew Vernon , Sun, 22 Nov 2015 16:07:27 +0000 diff --git a/debian/README.source b/debian/README.source new file mode 100644 index 0000000..193dde4 --- /dev/null +++ b/debian/README.source @@ -0,0 +1,17 @@ +The Debian packaging of pcre2 is maintained in git, using the merging +workflow described in dgit-maint-merge(7). There isn't a patch +queue that can be represented as a quilt series. + +A detailed breakdown of the changes is available from their +canonical representation - git commits in the packaging repository. +For example, to see the changes made by the Debian maintainer in +the first upload of upstream version 1.2.3, you could use: + + % git clone https://git.dgit.debian.org/pcre2 + % cd pcre2 + % git log --oneline 1.2.3..debian/1.2.3-1 -- . ':!debian' + +(If you have dgit, use `dgit clone pcre2`, rather than plain `git +clone`.) + + -- Matthew Vernon , Thu, 30 Nov 2017 14:16:33 +0000 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..f2ebe6f --- /dev/null +++ b/debian/changelog @@ -0,0 +1,340 @@ +pcre2 (10.46-1~deb13u3) trixie-security; urgency=high + + * Non-maintainer upload by the Security Team. + * GHSA-r9hj-j2rw-4q3m: Fix large JIT stack allocation (Closes: #1149217) + * For release, revert platform-specific test case + + -- Salvatore Bonaccorso Mon, 28 Sep 2026 16:07:53 +0200 + +pcre2 (10.46-1~deb13u2) trixie; urgency=high + + * Use upstream backports of security fixes from 10.48 + + -- Matthew Vernon Tue, 01 Sep 2026 11:46:58 +0100 + +pcre2 (10.46-1~deb13u1) trixie; urgency=high + + * New upstream release to fix CVE-2025-58050 (Closes: #1112278) + + -- Matthew Vernon Thu, 28 Aug 2025 08:43:18 +0100 + +pcre2 (10.45-1) unstable; urgency=medium + + * New upstream release + + -- Matthew Vernon Wed, 05 Feb 2025 09:25:16 +0000 + +pcre2 (10.45~rc1-1) experimental; urgency=medium + + * Upstream RC1 for 10.45 version + + -- Matthew Vernon Thu, 23 Jan 2025 09:49:13 +0000 + +pcre2 (10.44-5) unstable; urgency=medium + + * Enable JIT on loong64 (Closes: #1089230) + + -- Matthew Vernon Sun, 08 Dec 2024 13:05:09 +0000 + +pcre2 (10.44-4) unstable; urgency=medium + + * Disable JIT on armel (it requires v7) (Closes: 1087563) + + -- Matthew Vernon Fri, 15 Nov 2024 15:53:09 +0000 + +pcre2 (10.44-3) unstable; urgency=medium + + * Use dh_autoreconf to fix FTBFS on mips64el (Closes: #1087562) + * Cherry-pick upstream commit to fix 32-bit issue (Closes: #1087564) + + -- Matthew Vernon Fri, 15 Nov 2024 14:47:09 +0000 + +pcre2 (10.44-2) unstable; urgency=medium + + * Upload to unstable (Closes: #1086187) + * Update homepage URL (Closes: #1073087) + * Mention libre2-dev in libpcre2-dev description (Closes: #1082901) + + -- Matthew Vernon Thu, 14 Nov 2024 11:40:06 +0000 + +pcre2 (10.44-1) experimental; urgency=medium + + * New upstream version + + -- Matthew Vernon Fri, 08 Nov 2024 16:27:46 +0000 + +pcre2 (10.43-1) experimental; urgency=medium + + * New upstream version + + -- Matthew Vernon Sat, 17 Feb 2024 10:22:28 +0000 + +pcre2 (10.42-4) unstable; urgency=medium + + * Build with JIT support on riscv64 (Closes: #1050819) + + -- Matthew Vernon Tue, 29 Aug 2023 18:23:44 +0100 + +pcre2 (10.42-3) unstable; urgency=medium + + * Specify source format 1.0 explicitly (Closes: #1049910) + + -- Matthew Vernon Mon, 21 Aug 2023 11:44:09 +0100 + +pcre2 (10.42-2) unstable; urgency=medium + + * disable JIT on sparc (Closes: #1034779) + + -- Matthew Vernon Tue, 11 Jul 2023 23:11:09 +0100 + +pcre2 (10.42-1) unstable; urgency=medium + + * New upstream version + + -- Matthew Vernon Sun, 01 Jan 2023 15:44:06 +0000 + +pcre2 (10.40-3) unstable; urgency=medium + + * Support the noudeb build profile (Helmut Grohne). (Closes: #1024941) + + -- Matthew Vernon Fri, 02 Dec 2022 17:40:13 +0000 + +pcre2 (10.40-2) unstable; urgency=low + + * Move to machine-readable copyright file (Bastian Germann) + * Remove filenamemangle from debian/watch (Bastian Germann) + + -- Matthew Vernon Sun, 23 Oct 2022 16:07:18 +0100 + +pcre2 (10.40-1) unstable; urgency=medium + + * New upstream release + * Update watch file to note new upstream repo location + + -- Matthew Vernon Mon, 25 Apr 2022 17:10:36 +0100 + +pcre2 (10.39-4) unstable; urgency=medium + + * Backport upstream Hurd build fix (Closes: #1009066) + + -- Matthew Vernon Mon, 11 Apr 2022 09:23:48 +0100 + +pcre2 (10.39-3) unstable; urgency=medium + + * Enable JIT on s390x (Closes: #999836) + * Re-enable JIT on MIPS (Closes: #892488) + + -- Matthew Vernon Wed, 17 Nov 2021 14:52:42 +0000 + +pcre2 (10.39-2) unstable; urgency=medium + + * Update long descriptions of runtime packages (Closes: #978013) + * Source-only upload (-1 was binary to get through NEW) + * Depend on libc-dev rather than libc6-dev (Closes: #989729) + + -- Matthew Vernon Mon, 08 Nov 2021 23:47:21 +0000 + +pcre2 (10.39-1) unstable; urgency=medium + + * New upstream release + * Update watch file to reflect new upstream home on github + * libpcre2-posix soname updated + + -- Matthew Vernon Sat, 06 Nov 2021 13:56:27 +0000 + +pcre2 (10.36-2) unstable; urgency=medium + + * Upload to unstable + + -- Matthew Vernon Sun, 13 Dec 2020 16:23:03 +0000 + +pcre2 (10.36-1) experimental; urgency=medium + + * New upstream version + * Fix watch file + + -- Matthew Vernon Mon, 07 Dec 2020 12:35:19 +0000 + +pcre2 (10.35-2) unstable; urgency=medium + + * Upload to unstable + + -- Matthew Vernon Fri, 04 Dec 2020 09:52:04 +0000 + +pcre2 (10.35-1) experimental; urgency=medium + + * New upstream version + * Bump standards-version to 4.5.1 + + -- Matthew Vernon Fri, 27 Nov 2020 09:25:08 +0000 + +pcre2 (10.34-7) unstable; urgency=medium + + * Upstream patch to fix segfault in rspamd (Closes: #946221) + + -- Matthew Vernon Sat, 07 Dec 2019 17:06:59 +0000 + +pcre2 (10.34-6) unstable; urgency=high + + * Replace: and Conflict: the previous libpcre2-posix0 package (which + erroneously had the soname 2 library in) (Closes: #946279, #946290, #946311) + * Can now make a source-only upload now libpcre2-posix2 has made it + through NEW. We need that so we can migrate to testing (Closes: #946275) + + -- Matthew Vernon Sat, 07 Dec 2019 14:34:25 +0000 + +pcre2 (10.34-5) unstable; urgency=medium + + * Sacrifice an integer so I can do a binary upload for the new + libpcre2-posix package name :-( + + -- Matthew Vernon Tue, 03 Dec 2019 21:14:29 +0000 + +pcre2 (10.34-4) unstable; urgency=high + + * Add symbols files (Closes: #945973) + * Update libpcre2-posix name to match soname + + -- Matthew Vernon Tue, 03 Dec 2019 19:20:54 +0000 + +pcre2 (10.34-3) unstable; urgency=medium + + * Remove -dbg package from debian/control as well + + -- Matthew Vernon Mon, 02 Dec 2019 11:58:33 +0000 + +pcre2 (10.34-2) unstable; urgency=high + + * Try an upstream patch to fix an ARM bug (apropos 945972) + * Remove -dbg in favour of -dbgsyms, thanks to Michael Biebl + for the patch (Closes: #891624) + + -- Matthew Vernon Mon, 02 Dec 2019 11:22:32 +0000 + +pcre2 (10.34-1) unstable; urgency=medium + + * New upstream release + + -- Matthew Vernon Thu, 28 Nov 2019 16:28:31 +0000 + +pcre2 (10.32-5) unstable; urgency=high + + * Patch from Guillem Jover to only use SSE2 + instructions on those i386 CPUs that support them (Closes: #925360) + + -- Matthew Vernon Mon, 25 Mar 2019 19:56:19 +0000 + +pcre2 (10.32-4) unstable; urgency=medium + + * Take patch from Jeremy Bicha to build with + --disable-pcre2grep-callout: A grep tool should not be expected to + execute commands (Closes: #920273) (LP: #1636666) + + -- Matthew Vernon Thu, 24 Jan 2019 09:20:51 +0000 + +pcre2 (10.32-3) unstable; urgency=medium + + * Sacrifice an integer to dgit (previous upload didn't work) + + -- Matthew Vernon Sun, 28 Oct 2018 14:19:04 +0000 + +pcre2 (10.32-2) unstable; urgency=medium + + * Take Ondřej Nový's patch to remove redundant Priority field in -dbg + package + + -- Matthew Vernon Fri, 26 Oct 2018 20:01:53 +0100 + +pcre2 (10.32-1) unstable; urgency=medium + + * New upstream release + + -- Matthew Vernon Fri, 26 Oct 2018 19:27:13 +0100 + +pcre2 (10.31-3) unstable; urgency=medium + + * Disable JIT on mips* (apropos #892488) + + -- Matthew Vernon Sat, 10 Mar 2018 00:31:33 +0000 + +pcre2 (10.31-2) unstable; urgency=low + + * Point to salsa repo in vcs* fields + * priority extra -> optional + * Add homepage link in debian/control + * Update to newer standards-version + + -- Matthew Vernon Sat, 24 Feb 2018 14:57:26 +0000 + +pcre2 (10.31-1) unstable; urgency=medium + + * New upstream version (Closes: #883224) + + -- Matthew Vernon Sat, 24 Feb 2018 12:13:02 +0000 + +pcre2 (10.22-6) unstable; urgency=medium + + [ Cyril Brulebois ] + * Add a libpcre2-8-0-udeb, needed by vte2.91 (Closes: #887674) + * Enable parallel building. + + -- Matthew Vernon Sat, 03 Feb 2018 18:44:08 +0000 + +pcre2 (10.22-5) unstable; urgency=medium + + * Add Vcs-{Git,Browser} fields to debian/control + + -- Matthew Vernon Fri, 01 Dec 2017 17:35:06 +0000 + +pcre2 (10.22-4) unstable; urgency=low + + * Add README.source explaining packaging workflow (Closes: #862425) + + -- Matthew Vernon Thu, 30 Nov 2017 14:17:39 +0000 + +pcre2 (10.22-3) unstable; urgency=medium + + * CVE-2017-7186: invalid Unicode property lookup may cause denial of + service (Closes: #858233) + + -- Matthew Vernon Tue, 21 Mar 2017 22:33:58 +0000 + +pcre2 (10.22-2) unstable; urgency=low + + * re-upload with source :-( + + -- Matthew Vernon Tue, 02 Aug 2016 19:27:58 +0100 + +pcre2 (10.22-1) unstable; urgency=low + + * New upstream release + + -- Matthew Vernon Tue, 02 Aug 2016 18:59:19 +0100 + +pcre2 (10.21-1) unstable; urgency=low + + * New upstream version + * Upstream patch to fix workspace overflow for (*ACCEPT) with deeply + nested parentheses (Closes: #815920) + + -- Matthew Vernon Sat, 27 Feb 2016 15:21:34 +0000 + +pcre2 (10.20-3) unstable; urgency=low + + * Enable JIT on ppc64 & ppc64el (Closes: #806388) + + -- Matthew Vernon Fri, 27 Nov 2015 08:16:38 +0000 + +pcre2 (10.20-2) unstable; urgency=low + + * remove unnecessary -L settings (Closes: #805941) + * Improve makefile syntax, and add JIT on arm64 + + -- Matthew Vernon Tue, 24 Nov 2015 20:39:15 +0000 + +pcre2 (10.20-1) unstable; urgency=low + + * Initial debian version (Closes: #805728) + + -- Matthew Vernon Sun, 22 Nov 2015 15:58:38 +0000 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..248e6c7 --- /dev/null +++ b/debian/control @@ -0,0 +1,121 @@ +Source: pcre2 +Section: libs +Priority: optional +Maintainer: Matthew Vernon +Standards-Version: 4.5.1 +Build-Depends: debhelper (>=9), dpkg-dev (>= 1.16.1~), dh-autoreconf +Vcs-Git: https://salsa.debian.org/debian/pcre2.git +Vcs-Browser: https://salsa.debian.org/debian/pcre2 +Homepage: https://github.com/PCRE2Project/pcre2 + +Package: libpcre2-8-0 +Section: libs +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} +Description: New Perl Compatible Regular Expression Library- 8 bit runtime files + This is PCRE2, the new implementation of PCRE, a library of functions + to support regular expressions whose syntax and semantics are as + close as possible to those of the Perl 5 language. New projects + should use this library in preference to the older library, + confusingly called pcre3 in Debian. + . + This package contains the 8 bit runtime library, which operates on + ASCII and UTF-8 input. + +Package: libpcre2-8-0-udeb +Package-Type: udeb +Build-Profiles: +Section: debian-installer +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: New Perl Compatible Regular Expression Library- 8 bit runtime files (udeb) + This package contains the 8 bit runtime library, for the Debian Installer. + +Package: libpcre2-16-0 +Section: libs +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} +Description: New Perl Compatible Regular Expression Library - 16 bit runtime files + This is PCRE2, the new implementation of PCRE, a library of functions + to support regular expressions whose syntax and semantics are as + close as possible to those of the Perl 5 language. New projects + should use this library in preference to the older library, + confusingly called pcre3 in Debian. + . + This package contains the 16 bit runtime library, which operates on + UTF-16 input. + +Package: libpcre2-32-0 +Section: libs +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} +Description: New Perl Compatible Regular Expression Library - 32 bit runtime files + This is PCRE2, the new implementation of PCRE, a library of functions + to support regular expressions whose syntax and semantics are as + close as possible to those of the Perl 5 language. New projects + should use this library in preference to the older library, + confusingly called pcre3 in Debian. + . + This package contains the 32 bit runtime library, which operates on + UTF-32 input. + +Package: libpcre2-posix3 +Section: libs +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} +Replaces: libpcre2-posix0 +Conflicts: libpcre2-posix0 +Description: New Perl Compatible Regular Expression Library - posix-compatible runtime files + This is PCRE2, the new implementation of PCRE, a library of functions + to support regular expressions whose syntax and semantics are as + close as possible to those of the Perl 5 language. New projects + should use this library in preference to the older library, + confusingly called pcre3 in Debian. + . + This package contains the runtime library for the posix-compatible API. + +Package: libpcre2-dev +Section: libdevel +Architecture: any +Multi-Arch: same +Conflicts: libpcre3-dev (<<2:8.35-8) +Depends: libc-dev, libpcre2-8-0 (= ${binary:Version}), libpcre2-16-0 (= ${binary:Version}), libpcre2-32-0 (= ${binary:Version}), libpcre2-posix3 (= ${binary:Version}), ${misc:Depends} +Description: New Perl Compatible Regular Expression Library - development files + This is PCRE2, the new implementation of PCRE, a library of functions + to support regular expressions whose syntax and semantics are as + close as possible to those of the Perl 5 language. New projects + should use this library in preference to the older library, + confusingly called pcre3 in Debian. + . + Unlike the previous version of PCRE, there is no C++ library included + with PCRE2. Users who wish to avoid porting their C++ code to use the + PCRE2 C API might want to consider the libre2-dev package in Debian + which attempts to provide a similar C++ API to that provided by + libpcrecpp in previous versions of PCRE. + . + This package contains the development files, including headers, + static libraries, and documentation. + +Package: pcre2-utils +Section: utils +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: New Perl Compatible Regular Expression Library - utilities + This is PCRE2, the new implementation of PCRE, a library of functions + to support regular expressions whose syntax and semantics are as + close as possible to those of the Perl 5 language. New projects + should use this library in preference to the older library, + confusingly called pcre3 in Debian. + . + This package contains the utilities pcre2grep (like grep with PCRE) + and pcre2test (a test program for the library, but also useful for + experimenting with regular expressions). Both programs are also + useful examples of programming with libpcre2. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..66e9582 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,122 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Comment: This package was debianized by Matthew Vernon +Source: https://github.com/PCRE2Project/pcre2/releases + +Files: * +Copyright: 1997-2022 University of Cambridge. +License: BSD-3-clause-Cambridge with BINARY LIBRARY-LIKE PACKAGES exception + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + . + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + . + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + * Neither the name of the University of Cambridge nor the names of any + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + . + . + EXEMPTION FOR BINARY LIBRARY-LIKE PACKAGES + ------------------------------------------ + . + The second condition in the BSD licence (covering binary redistributions) does + not apply all the way down a chain of software. If binary package A includes + PCRE2, it must respect the condition, but if package B is software that + includes package A, the condition is not imposed on package B unless it uses + PCRE2 independently. + +Files: cmake/Find* +Copyright: KDE Community +License: BSD-3-clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + 1. Redistributions of source code must retain the copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Files: install-sh +Copyright: (C) 1994 X Consortium +License: X11 + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- + TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + . + Except as contained in this notice, the name of the X Consortium shall not + be used in advertising or otherwise to promote the sale, use or other deal- + ings in this Software without prior written authorization from the X Consor- + tium. +Comment: FSF changes to this file are in the public domain. + +Files: deps/sljit/* +Copyright: Zoltan Herczeg (hzmester@freemail.hu). All rights reserved. +License: BSD-2-clause + Redistribution and use in source and binary forms, with or without modification, are + permitted provided that the following conditions are met: + . + 1. Redistributions of source code must retain the above copyright notice, this list of + conditions and the following disclaimer. + . + 2. Redistributions in binary form must reproduce the above copyright notice, this list + of conditions and the following disclaimer in the documentation and/or other materials + provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND CONTRIBUTORS ``AS IS'' AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + SHALL THE COPYRIGHT HOLDER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Files: testdata/* +Copyright: None (public-domain) +License: public-domain + The data in the testdata directory is not copyrighted and is in the public domain. diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 0000000..ffb5934 --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,8 @@ +[DEFAULT] +upstream-branch = upstream +debian-branch = master +upstream-tag = %(version)s + +sign-tags = False +pristine-tar = False +pristine-tar-commit = False diff --git a/debian/libpcre2-16-0.install b/debian/libpcre2-16-0.install new file mode 100644 index 0000000..8582b10 --- /dev/null +++ b/debian/libpcre2-16-0.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/*/libpcre2-16.so.* diff --git a/debian/libpcre2-16-0.symbols b/debian/libpcre2-16-0.symbols new file mode 100644 index 0000000..90b61e8 --- /dev/null +++ b/debian/libpcre2-16-0.symbols @@ -0,0 +1,79 @@ +libpcre2-16.so.0 libpcre2-16-0 #MINVER# + pcre2_callout_enumerate_16@Base 10.22 + pcre2_code_copy_16@Base 10.22 + pcre2_code_copy_with_tables_16@Base 10.32 + pcre2_code_free_16@Base 10.22 + pcre2_compile_16@Base 10.22 + pcre2_compile_context_copy_16@Base 10.22 + pcre2_compile_context_create_16@Base 10.22 + pcre2_compile_context_free_16@Base 10.22 + pcre2_config_16@Base 10.22 + pcre2_convert_context_copy_16@Base 10.32 + pcre2_convert_context_create_16@Base 10.32 + pcre2_convert_context_free_16@Base 10.32 + pcre2_converted_pattern_free_16@Base 10.32 + pcre2_dfa_match_16@Base 10.22 + pcre2_general_context_copy_16@Base 10.22 + pcre2_general_context_create_16@Base 10.22 + pcre2_general_context_free_16@Base 10.22 + pcre2_get_error_message_16@Base 10.22 + pcre2_get_mark_16@Base 10.22 + pcre2_get_match_data_heapframes_size_16@Base 10.43 + pcre2_get_match_data_size_16@Base 10.34 + pcre2_get_ovector_count_16@Base 10.22 + pcre2_get_ovector_pointer_16@Base 10.22 + pcre2_get_startchar_16@Base 10.22 + pcre2_jit_compile_16@Base 10.22 + pcre2_jit_free_unused_memory_16@Base 10.22 + pcre2_jit_match_16@Base 10.22 + pcre2_jit_stack_assign_16@Base 10.22 + pcre2_jit_stack_create_16@Base 10.22 + pcre2_jit_stack_free_16@Base 10.22 + pcre2_maketables_16@Base 10.22 + pcre2_maketables_free_16@Base 10.34 + pcre2_match_16@Base 10.22 + pcre2_match_context_copy_16@Base 10.22 + pcre2_match_context_create_16@Base 10.22 + pcre2_match_context_free_16@Base 10.22 + pcre2_match_data_create_16@Base 10.22 + pcre2_match_data_create_from_pattern_16@Base 10.22 + pcre2_match_data_free_16@Base 10.22 + pcre2_pattern_convert_16@Base 10.32 + pcre2_pattern_info_16@Base 10.22 + pcre2_serialize_decode_16@Base 10.22 + pcre2_serialize_encode_16@Base 10.22 + pcre2_serialize_free_16@Base 10.22 + pcre2_serialize_get_number_of_codes_16@Base 10.22 + pcre2_set_bsr_16@Base 10.22 + pcre2_set_callout_16@Base 10.22 + pcre2_set_character_tables_16@Base 10.22 + pcre2_set_compile_extra_options_16@Base 10.32 + pcre2_set_compile_recursion_guard_16@Base 10.22 + pcre2_set_depth_limit_16@Base 10.32 + pcre2_set_glob_escape_16@Base 10.32 + pcre2_set_glob_separator_16@Base 10.32 + pcre2_set_heap_limit_16@Base 10.32 + pcre2_set_match_limit_16@Base 10.22 + pcre2_set_max_pattern_compiled_length_16@Base 10.44 + pcre2_set_max_pattern_length_16@Base 10.22 + pcre2_set_max_varlookbehind_16@Base 10.43 + pcre2_set_newline_16@Base 10.22 + pcre2_set_offset_limit_16@Base 10.22 + pcre2_set_optimize_16@Base 10.45~rc1 + pcre2_set_parens_nest_limit_16@Base 10.22 + pcre2_set_recursion_limit_16@Base 10.22 + pcre2_set_recursion_memory_management_16@Base 10.22 + pcre2_set_substitute_callout_16@Base 10.34 + pcre2_set_substitute_case_callout_16@Base 10.45~rc1 + pcre2_substitute_16@Base 10.22 + pcre2_substring_copy_byname_16@Base 10.22 + pcre2_substring_copy_bynumber_16@Base 10.22 + pcre2_substring_free_16@Base 10.22 + pcre2_substring_get_byname_16@Base 10.22 + pcre2_substring_get_bynumber_16@Base 10.22 + pcre2_substring_length_byname_16@Base 10.22 + pcre2_substring_length_bynumber_16@Base 10.22 + pcre2_substring_list_free_16@Base 10.22 + pcre2_substring_list_get_16@Base 10.22 + pcre2_substring_nametable_scan_16@Base 10.22 + pcre2_substring_number_from_name_16@Base 10.22 diff --git a/debian/libpcre2-32-0.install b/debian/libpcre2-32-0.install new file mode 100644 index 0000000..f3dea05 --- /dev/null +++ b/debian/libpcre2-32-0.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/*/libpcre2-32.so.* diff --git a/debian/libpcre2-32-0.symbols b/debian/libpcre2-32-0.symbols new file mode 100644 index 0000000..c6bd739 --- /dev/null +++ b/debian/libpcre2-32-0.symbols @@ -0,0 +1,79 @@ +libpcre2-32.so.0 libpcre2-32-0 #MINVER# + pcre2_callout_enumerate_32@Base 10.22 + pcre2_code_copy_32@Base 10.22 + pcre2_code_copy_with_tables_32@Base 10.32 + pcre2_code_free_32@Base 10.22 + pcre2_compile_32@Base 10.22 + pcre2_compile_context_copy_32@Base 10.22 + pcre2_compile_context_create_32@Base 10.22 + pcre2_compile_context_free_32@Base 10.22 + pcre2_config_32@Base 10.22 + pcre2_convert_context_copy_32@Base 10.32 + pcre2_convert_context_create_32@Base 10.32 + pcre2_convert_context_free_32@Base 10.32 + pcre2_converted_pattern_free_32@Base 10.32 + pcre2_dfa_match_32@Base 10.22 + pcre2_general_context_copy_32@Base 10.22 + pcre2_general_context_create_32@Base 10.22 + pcre2_general_context_free_32@Base 10.22 + pcre2_get_error_message_32@Base 10.22 + pcre2_get_mark_32@Base 10.22 + pcre2_get_match_data_heapframes_size_32@Base 10.43 + pcre2_get_match_data_size_32@Base 10.34 + pcre2_get_ovector_count_32@Base 10.22 + pcre2_get_ovector_pointer_32@Base 10.22 + pcre2_get_startchar_32@Base 10.22 + pcre2_jit_compile_32@Base 10.22 + pcre2_jit_free_unused_memory_32@Base 10.22 + pcre2_jit_match_32@Base 10.22 + pcre2_jit_stack_assign_32@Base 10.22 + pcre2_jit_stack_create_32@Base 10.22 + pcre2_jit_stack_free_32@Base 10.22 + pcre2_maketables_32@Base 10.22 + pcre2_maketables_free_32@Base 10.34 + pcre2_match_32@Base 10.22 + pcre2_match_context_copy_32@Base 10.22 + pcre2_match_context_create_32@Base 10.22 + pcre2_match_context_free_32@Base 10.22 + pcre2_match_data_create_32@Base 10.22 + pcre2_match_data_create_from_pattern_32@Base 10.22 + pcre2_match_data_free_32@Base 10.22 + pcre2_pattern_convert_32@Base 10.32 + pcre2_pattern_info_32@Base 10.22 + pcre2_serialize_decode_32@Base 10.22 + pcre2_serialize_encode_32@Base 10.22 + pcre2_serialize_free_32@Base 10.22 + pcre2_serialize_get_number_of_codes_32@Base 10.22 + pcre2_set_bsr_32@Base 10.22 + pcre2_set_callout_32@Base 10.22 + pcre2_set_character_tables_32@Base 10.22 + pcre2_set_compile_extra_options_32@Base 10.32 + pcre2_set_compile_recursion_guard_32@Base 10.22 + pcre2_set_depth_limit_32@Base 10.32 + pcre2_set_glob_escape_32@Base 10.32 + pcre2_set_glob_separator_32@Base 10.32 + pcre2_set_heap_limit_32@Base 10.32 + pcre2_set_match_limit_32@Base 10.22 + pcre2_set_max_pattern_compiled_length_32@Base 10.44 + pcre2_set_max_pattern_length_32@Base 10.22 + pcre2_set_max_varlookbehind_32@Base 10.43 + pcre2_set_newline_32@Base 10.22 + pcre2_set_offset_limit_32@Base 10.22 + pcre2_set_optimize_32@Base 10.45~rc1 + pcre2_set_parens_nest_limit_32@Base 10.22 + pcre2_set_recursion_limit_32@Base 10.22 + pcre2_set_recursion_memory_management_32@Base 10.22 + pcre2_set_substitute_callout_32@Base 10.34 + pcre2_set_substitute_case_callout_32@Base 10.45~rc1 + pcre2_substitute_32@Base 10.22 + pcre2_substring_copy_byname_32@Base 10.22 + pcre2_substring_copy_bynumber_32@Base 10.22 + pcre2_substring_free_32@Base 10.22 + pcre2_substring_get_byname_32@Base 10.22 + pcre2_substring_get_bynumber_32@Base 10.22 + pcre2_substring_length_byname_32@Base 10.22 + pcre2_substring_length_bynumber_32@Base 10.22 + pcre2_substring_list_free_32@Base 10.22 + pcre2_substring_list_get_32@Base 10.22 + pcre2_substring_nametable_scan_32@Base 10.22 + pcre2_substring_number_from_name_32@Base 10.22 diff --git a/debian/libpcre2-8-0-udeb.install b/debian/libpcre2-8-0-udeb.install new file mode 100644 index 0000000..1a38dd6 --- /dev/null +++ b/debian/libpcre2-8-0-udeb.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/*/libpcre2-8.so.* diff --git a/debian/libpcre2-8-0.install b/debian/libpcre2-8-0.install new file mode 100644 index 0000000..1a38dd6 --- /dev/null +++ b/debian/libpcre2-8-0.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/*/libpcre2-8.so.* diff --git a/debian/libpcre2-8-0.symbols b/debian/libpcre2-8-0.symbols new file mode 100644 index 0000000..8f6a1ee --- /dev/null +++ b/debian/libpcre2-8-0.symbols @@ -0,0 +1,79 @@ +libpcre2-8.so.0 libpcre2-8-0 #MINVER# + pcre2_callout_enumerate_8@Base 10.22 + pcre2_code_copy_8@Base 10.22 + pcre2_code_copy_with_tables_8@Base 10.32 + pcre2_code_free_8@Base 10.22 + pcre2_compile_8@Base 10.22 + pcre2_compile_context_copy_8@Base 10.22 + pcre2_compile_context_create_8@Base 10.22 + pcre2_compile_context_free_8@Base 10.22 + pcre2_config_8@Base 10.22 + pcre2_convert_context_copy_8@Base 10.32 + pcre2_convert_context_create_8@Base 10.32 + pcre2_convert_context_free_8@Base 10.32 + pcre2_converted_pattern_free_8@Base 10.32 + pcre2_dfa_match_8@Base 10.22 + pcre2_general_context_copy_8@Base 10.22 + pcre2_general_context_create_8@Base 10.22 + pcre2_general_context_free_8@Base 10.22 + pcre2_get_error_message_8@Base 10.22 + pcre2_get_mark_8@Base 10.22 + pcre2_get_match_data_heapframes_size_8@Base 10.43 + pcre2_get_match_data_size_8@Base 10.34 + pcre2_get_ovector_count_8@Base 10.22 + pcre2_get_ovector_pointer_8@Base 10.22 + pcre2_get_startchar_8@Base 10.22 + pcre2_jit_compile_8@Base 10.22 + pcre2_jit_free_unused_memory_8@Base 10.22 + pcre2_jit_match_8@Base 10.22 + pcre2_jit_stack_assign_8@Base 10.22 + pcre2_jit_stack_create_8@Base 10.22 + pcre2_jit_stack_free_8@Base 10.22 + pcre2_maketables_8@Base 10.22 + pcre2_maketables_free_8@Base 10.34 + pcre2_match_8@Base 10.22 + pcre2_match_context_copy_8@Base 10.22 + pcre2_match_context_create_8@Base 10.22 + pcre2_match_context_free_8@Base 10.22 + pcre2_match_data_create_8@Base 10.22 + pcre2_match_data_create_from_pattern_8@Base 10.22 + pcre2_match_data_free_8@Base 10.22 + pcre2_pattern_convert_8@Base 10.32 + pcre2_pattern_info_8@Base 10.22 + pcre2_serialize_decode_8@Base 10.22 + pcre2_serialize_encode_8@Base 10.22 + pcre2_serialize_free_8@Base 10.22 + pcre2_serialize_get_number_of_codes_8@Base 10.22 + pcre2_set_bsr_8@Base 10.22 + pcre2_set_callout_8@Base 10.22 + pcre2_set_character_tables_8@Base 10.22 + pcre2_set_compile_extra_options_8@Base 10.32 + pcre2_set_compile_recursion_guard_8@Base 10.22 + pcre2_set_depth_limit_8@Base 10.32 + pcre2_set_glob_escape_8@Base 10.32 + pcre2_set_glob_separator_8@Base 10.32 + pcre2_set_heap_limit_8@Base 10.32 + pcre2_set_match_limit_8@Base 10.22 + pcre2_set_max_pattern_compiled_length_8@Base 10.44 + pcre2_set_max_pattern_length_8@Base 10.22 + pcre2_set_max_varlookbehind_8@Base 10.43 + pcre2_set_newline_8@Base 10.22 + pcre2_set_offset_limit_8@Base 10.22 + pcre2_set_optimize_8@Base 10.45~rc1 + pcre2_set_parens_nest_limit_8@Base 10.22 + pcre2_set_recursion_limit_8@Base 10.22 + pcre2_set_recursion_memory_management_8@Base 10.22 + pcre2_set_substitute_callout_8@Base 10.34 + pcre2_set_substitute_case_callout_8@Base 10.45~rc1 + pcre2_substitute_8@Base 10.22 + pcre2_substring_copy_byname_8@Base 10.22 + pcre2_substring_copy_bynumber_8@Base 10.22 + pcre2_substring_free_8@Base 10.22 + pcre2_substring_get_byname_8@Base 10.22 + pcre2_substring_get_bynumber_8@Base 10.22 + pcre2_substring_length_byname_8@Base 10.22 + pcre2_substring_length_bynumber_8@Base 10.22 + pcre2_substring_list_free_8@Base 10.22 + pcre2_substring_list_get_8@Base 10.22 + pcre2_substring_nametable_scan_8@Base 10.22 + pcre2_substring_number_from_name_8@Base 10.22 diff --git a/debian/libpcre2-dev.install b/debian/libpcre2-dev.install new file mode 100644 index 0000000..52ce644 --- /dev/null +++ b/debian/libpcre2-dev.install @@ -0,0 +1,6 @@ +debian/tmp/usr/include/* +debian/tmp/usr/lib/*/lib*.a +debian/tmp/usr/lib/*/lib*.so +debian/tmp/usr/lib/*/pkgconfig/* +debian/tmp/usr/bin/*-config +debian/tmp/usr/share/man/man3/* diff --git a/debian/libpcre2-dev.manpages b/debian/libpcre2-dev.manpages new file mode 100644 index 0000000..c4b82bb --- /dev/null +++ b/debian/libpcre2-dev.manpages @@ -0,0 +1 @@ +debian/tmp/usr/share/man/man1/pcre2-config.1 diff --git a/debian/libpcre2-posix3.install b/debian/libpcre2-posix3.install new file mode 100644 index 0000000..2669a04 --- /dev/null +++ b/debian/libpcre2-posix3.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/*/libpcre2-posix.so.* diff --git a/debian/libpcre2-posix3.symbols b/debian/libpcre2-posix3.symbols new file mode 100644 index 0000000..a17ee83 --- /dev/null +++ b/debian/libpcre2-posix3.symbols @@ -0,0 +1,9 @@ +libpcre2-posix.so.3 libpcre2-posix3 #MINVER# + pcre2_regcomp@Base 10.34 + pcre2_regerror@Base 10.34 + pcre2_regexec@Base 10.34 + pcre2_regfree@Base 10.34 +#MISSING: 10.39-1# regcomp@Base 10.34 +#MISSING: 10.39-1# regerror@Base 10.34 +#MISSING: 10.39-1# regexec@Base 10.34 +#MISSING: 10.39-1# regfree@Base 10.34 diff --git a/debian/pcre2-utils.install b/debian/pcre2-utils.install new file mode 100644 index 0000000..ded3f24 --- /dev/null +++ b/debian/pcre2-utils.install @@ -0,0 +1,4 @@ +debian/tmp/usr/bin/pcre2test +debian/tmp/usr/bin/pcre2grep +debian/tmp/usr/share/man/man1/pcre2test.1 +debian/tmp/usr/share/man/man1/pcre2grep.1 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..1bf190f --- /dev/null +++ b/debian/rules @@ -0,0 +1,32 @@ +#!/usr/bin/make -f +# See debhelper(7) +# output every command that modifies files on the build system. +#DH_VERBOSE = 1 + +# see dpkg-buildflags(1) +DPKG_EXPORT_BUILDFLAGS = 1 +include /usr/share/dpkg/default.mk +# prefix names of functions in libpcreposix with PCRE2 to avoid clash with +# ones in libc. +export DEB_CFLAGS_MAINT_APPEND = -Dregcomp=PCRE2regcomp -Dregexec=PCRE2regexec -Dregerror=PCRE2regerror -Dregfree=PCRE2regfree + + +deb_maint_conf_args = --enable-pcre2-16 --enable-pcre2-32 --disable-pcre2grep-callout +#enable JIT only on architectures that support it (see pcre2jit.3) +ifneq ($(filter amd64 armhf arm64 i386 loong64 mips mipsel mips64el powerpc ppc64 ppc64el riscv64 s390x, $(DEB_HOST_ARCH)),) +deb_maint_conf_args +=--enable-jit +else +deb_maint_conf_args +=--disable-jit +endif + +%: + dh $@ --parallel --with autoreconf + +override_dh_auto_configure: + dh_auto_configure -- $(deb_maint_conf_args) + +override_dh_makeshlibs: + dh_makeshlibs -V --add-udeb=libpcre2-8-0-udeb + +override_dh_strip: + dh_strip --dbgsym-migration='libpcre2-dbg (<< 10.34-2~)' diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..d3827e7 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +1.0 diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..0883e43 --- /dev/null +++ b/debian/watch @@ -0,0 +1,2 @@ +version=4 + https://github.com/PCRE2Project/pcre2/releases .*/?(\d{2}\.\d{2})\.tar\.gz diff --git a/pcre2-config.in b/pcre2-config.in index 9639a90..4534ea0 100644 --- a/pcre2-config.in +++ b/pcre2-config.in @@ -28,19 +28,8 @@ if test $# -eq 0; then fi libR= -case `uname -s` in - *SunOS*) - libR=" -R@libdir@" - ;; - *BSD*) - libR=" -Wl,-R@libdir@" - ;; -esac libS= -if test @libdir@ != /usr/lib ; then - libS=-L@libdir@ -fi while test $# -gt 0; do case "$1" in diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c index 0ffac89..78cc66a 100644 --- a/src/pcre2_compile.c +++ b/src/pcre2_compile.c @@ -6069,7 +6069,8 @@ for (;; pptr++) if (meta < META_ASTERISK || meta > META_MINMAX_QUERY) { - if (OFLOW_MAX - *lengthptr < (PCRE2_SIZE)(code - orig_code)) + if (*lengthptr > OFLOW_MAX || + OFLOW_MAX - *lengthptr < (PCRE2_SIZE)(code - orig_code)) { *errorcodeptr = ERR20; /* Integer overflow */ return 0; @@ -8548,7 +8549,8 @@ for (;;) *reqcuflagsptr = reqcuflags; if (lengthptr != NULL) { - if (OFLOW_MAX - *lengthptr < length) + if (*lengthptr > MAX_PATTERN_SIZE || + MAX_PATTERN_SIZE - *lengthptr < length) { *errorcodeptr = ERR20; return 0; @@ -8571,6 +8573,19 @@ for (;;) { code = *codeptr + 1 + LINK_SIZE + skipunits; length += 1 + LINK_SIZE; + + /* Move the accumulated length into *lengthptr, providing the next call to + compile_branch with as much space in &length and &code as the first did. */ + + if (*lengthptr > MAX_PATTERN_SIZE || + MAX_PATTERN_SIZE - *lengthptr < length) + { + *errorcodeptr = ERR20; + cb->erroroffset = 0; + return 0; + } + *lengthptr += length; + length = 0; } else { @@ -10626,7 +10641,8 @@ if (errorcode != 0) goto HAD_CB_ERROR; /* Offset is in cb.erroroffset */ #if defined SUPPORT_WIDE_CHARS PCRE2_ASSERT((cb.char_lists_size & 0x3) == 0); if (length > MAX_PATTERN_SIZE || - MAX_PATTERN_SIZE - length < (cb.char_lists_size / sizeof(PCRE2_UCHAR))) + BYTES2CU(cb.char_lists_size) > MAX_PATTERN_SIZE || + MAX_PATTERN_SIZE - length < BYTES2CU(cb.char_lists_size)) #else if (length > MAX_PATTERN_SIZE) #endif @@ -10650,11 +10666,36 @@ if (cb.char_lists_size != 0) /* Align to 32 bit first. This ensures the allocated area will also be 32 bit aligned. */ re_blocksize = (PCRE2_SIZE)CLIST_ALIGN_TO(re_blocksize, sizeof(uint32_t)); +#else + /* Already 32 bit aligned. */ #endif + + /* We have bounded the length and BYTES2CU(char_lists_size) to + MAX_PATTERN_SIZE units, however (with 32-bit code units) char_lists_size + in bytes could still be extremely close to (or greater than) SIZE_MAX, so + we require another overflow check. */ + + if (cb.char_lists_size > PCRE2_SIZE_MAX - re_blocksize) + { + errorcode = ERR20; + cb.erroroffset = 0; + goto HAD_CB_ERROR; + } + re_blocksize += cb.char_lists_size; } #endif +if (length > BYTES2CU(PCRE2_SIZE_MAX - re_blocksize)) + { + /* Given the current value of 2^30 for MAX_PATTERN_SIZE, this block is only + reachable when both PCRE2_CODE_UNIT_WIDTH >= 16 and sizeof(size_t) is + 32 bits. */ + errorcode = ERR20; + cb.erroroffset = 0; + goto HAD_CB_ERROR; + } + re_blocksize += CU2BYTES(length); if (re_blocksize > ccontext->max_pattern_compiled_length) @@ -10663,7 +10704,15 @@ if (re_blocksize > ccontext->max_pattern_compiled_length) goto HAD_CB_ERROR; } +if (sizeof(pcre2_real_code) > PCRE2_SIZE_MAX - re_blocksize) + { + errorcode = ERR20; + cb.erroroffset = 0; + goto HAD_CB_ERROR; + } + re_blocksize += sizeof(pcre2_real_code); + re = (pcre2_real_code *) ccontext->memctl.malloc(re_blocksize, ccontext->memctl.memory_data); if (re == NULL) diff --git a/src/pcre2_compile_class.c b/src/pcre2_compile_class.c index 6a73bb9..f3e7d1d 100644 --- a/src/pcre2_compile_class.c +++ b/src/pcre2_compile_class.c @@ -499,7 +499,7 @@ static const uint32_t char_list_starts[] = { static class_ranges * compile_optimize_class(uint32_t *start_ptr, uint32_t options, - uint32_t xoptions, compile_block *cb) + uint32_t xoptions, int *errorcodeptr, compile_block *cb) { class_ranges* cranges; uint32_t *ptr; @@ -536,12 +536,23 @@ PCRE2_ASSERT((range_list_size & 0x1) == 0); total_size = range_list_size + ((range_list_size >= 2) ? CHAR_LIST_EXTRA_SIZE : 0); +if (total_size > (PCRE2_SIZE_MAX - sizeof(class_ranges)) / sizeof(uint32_t)) + { + *errorcodeptr = ERR20; + cb->erroroffset = 0; + return NULL; + } cranges = cb->cx->memctl.malloc( sizeof(class_ranges) + total_size * sizeof(uint32_t), cb->cx->memctl.memory_data); -if (cranges == NULL) return NULL; +if (cranges == NULL) + { + *errorcodeptr = ERR21; + cb->erroroffset = 0; + return NULL; + } cranges->next = NULL; cranges->range_list_size = (uint16_t)range_list_size; @@ -716,9 +727,13 @@ while (TRUE) else cranges->char_lists_types |= tmp1 << tmp2; - if (range_start < XCL_CHAR_LIST_LOW_16_START) break; + if (range_end < XCL_CHAR_LIST_LOW_16_START || tmp2 == 0) + { + PCRE2_ASSERT(range_start < XCL_CHAR_LIST_LOW_16_START); + break; + } - PCRE2_ASSERT(tmp2 >= XCL_TYPE_BIT_LEN); + PCRE2_ASSERT((tmp2 % XCL_TYPE_BIT_LEN) == 0); char_list_end = char_list_start - 1; char_list_start = *char_list_next++; tmp1 = 0; @@ -1103,13 +1118,10 @@ if (utf) { if (lengthptr != NULL) { - cranges = compile_optimize_class(pptr, options, xoptions, cb); + cranges = compile_optimize_class(pptr, options, xoptions, errorcodeptr, cb); if (cranges == NULL) - { - *errorcodeptr = ERR21; return NULL; - } /* Caching the pre-processed character ranges. */ if (cb->next_cranges != NULL) @@ -1727,18 +1739,17 @@ if ((xclass_props & XCLASS_REQUIRED) != 0) *lengthptr += 1 + LINK_SIZE; #endif - cb->char_lists_size += char_lists_size; + PCRE2_ASSERT(BYTES2CU(cb->char_lists_size) <= MAX_PATTERN_SIZE); - char_lists_size /= sizeof(PCRE2_UCHAR); - - /* Storage space for character lists is included - in the maximum pattern size. */ - if (*lengthptr > MAX_PATTERN_SIZE || - MAX_PATTERN_SIZE - *lengthptr < char_lists_size) + if (char_lists_size > PCRE2_SIZE_MAX - cb->char_lists_size || + BYTES2CU(char_lists_size) > MAX_PATTERN_SIZE || + BYTES2CU(cb->char_lists_size) > MAX_PATTERN_SIZE - BYTES2CU(char_lists_size)) { *errorcodeptr = ERR20; /* Pattern is too large */ return NULL; } + + cb->char_lists_size += char_lists_size; } else { @@ -1761,6 +1772,8 @@ if ((xclass_props & XCLASS_REQUIRED) != 0) Each list is aligned to 32 bit with an optional unused 16 bit value at the beginning of the character list. */ + PCRE2_ASSERT(char_lists_size <= PCRE2_SIZE_MAX - cb->char_lists_size); + cb->char_lists_size += char_lists_size; data = (uint8_t*)cb->start_code - cb->char_lists_size; @@ -1774,17 +1787,14 @@ if ((xclass_props & XCLASS_REQUIRED) != 0) PUT(code, 0, (uint32_t)(char_lists_size >> 1)); code += LINK_SIZE; -#if defined PCRE2_DEBUG || defined SUPPORT_VALGRIND + /* If we added padding to align the list, initialize the bytes to + defined values, so the library is valgrind-clean. It could also + be a security concern for clients calling into PCRE2 via bindings + from a memory-safe language, if pcre2_serialize_encode() exposes + uninitialized memory that may contain sensitive information. */ + if ((char_lists_size & 0x2) != 0) - { - /* In debug the unused 16 bit value is set - to a fixed value and marked unused. */ - ((uint16_t*)data)[-1] = 0x5555; -#ifdef SUPPORT_VALGRIND - VALGRIND_MAKE_MEM_NOACCESS(data - 2, 2); -#endif - } -#endif + ((uint16_t*)data)[-1] = 0xdead; cb->char_lists_size = CLIST_ALIGN_TO(char_lists_size, sizeof(uint32_t)); diff --git a/src/pcre2_convert.c b/src/pcre2_convert.c index d2b238c..4080496 100644 --- a/src/pcre2_convert.c +++ b/src/pcre2_convert.c @@ -1148,9 +1148,12 @@ for (int i = 0; i < 2; i++) /* Allocate memory for the buffer, with hidden space for an allocator at the start. The next time round the loop runs the conversion for real. */ - allocated = PRIV(memctl_malloc)(sizeof(pcre2_memctl) + - (*bufflenptr + 1)*PCRE2_CODE_UNIT_WIDTH, (pcre2_memctl *)ccontext); - if (allocated == NULL) return PCRE2_ERROR_NOMEMORY; + if (*bufflenptr > ((PCRE2_SIZE_MAX - sizeof(pcre2_memctl)) / + CU2BYTES(1)) - 1 || + (allocated = PRIV(memctl_malloc)(sizeof(pcre2_memctl) + + CU2BYTES(*bufflenptr + 1), + (pcre2_memctl *)ccontext)) == NULL) + return PCRE2_ERROR_NOMEMORY; *buffptr = (PCRE2_UCHAR *)(((char *)allocated) + sizeof(pcre2_memctl)); use_buffer = *buffptr; diff --git a/src/pcre2_dfa_match.c b/src/pcre2_dfa_match.c index ebf31d2..9911acf 100644 --- a/src/pcre2_dfa_match.c +++ b/src/pcre2_dfa_match.c @@ -407,8 +407,8 @@ return (mb->callout)(cb, mb->callout_data); /* This function is called when internal_dfa_match() is about to be called recursively and there is insufficient working space left in the current -workspace block. If there's an existing next block, use it; otherwise get a new -block unless the heap limit is reached. +workspace block. If there's a sufficiently large next block, use it; get a new +block unless the heap limit is (or has been) reached. Arguments: rwsptr pointer to block pointer (updated) @@ -424,9 +424,18 @@ more_workspace(RWS_anchor **rwsptr, unsigned int ovecsize, dfa_match_block *mb) { RWS_anchor *rws = *rwsptr; RWS_anchor *new; +uint32_t requested; + +PCRE2_ASSERT(ovecsize <= UINT32_MAX - RWS_RSIZE - RWS_ANCHOR_SIZE); +requested = RWS_RSIZE + ovecsize + RWS_ANCHOR_SIZE; if (rws->next != NULL) { + /* Although the initial block is large, and subsequent ones try to double, the + heap limit may cause the last one to be smaller; in this case, we have already + hit the heap limit and allocating a larger block will not be possible. */ + if (rws->next->size < requested) + return PCRE2_ERROR_HEAPLIMIT; new = rws->next; } @@ -436,14 +445,30 @@ overflow. */ else { - uint32_t newsize = (rws->size >= UINT32_MAX/(sizeof(int)*2))? UINT32_MAX/sizeof(int) : rws->size * 2; + uint32_t newsize = (rws->size >= (UINT32_MAX/sizeof(int))/2)? + UINT32_MAX/sizeof(int) : rws->size * 2; uint32_t newsizeK = newsize/(1024/sizeof(int)); - if (newsizeK + mb->heap_used > mb->heap_limit) - newsizeK = (uint32_t)(mb->heap_limit - mb->heap_used); - newsize = newsizeK*(1024/sizeof(int)); + /* Clamp the allocation to the remaining heap allowance with care for overflows */ + + if (mb->heap_used >= mb->heap_limit) + { + newsize = 0; + newsizeK = 0; + } + else + { + PCRE2_SIZE availableK = mb->heap_limit - mb->heap_used; + /* newsize always capped at UINT32_MAX/sizeof(int), so newsizeK also capped; + and - if availableK is smaller - then multiplication to form newsize is safe */ + if (newsizeK > availableK) + { + newsize = (uint32_t)(availableK*(1024/sizeof(int))); + newsizeK = availableK; + } + } - if (newsize < RWS_RSIZE + ovecsize + RWS_ANCHOR_SIZE) + if (newsize < requested) return PCRE2_ERROR_HEAPLIMIT; new = mb->memctl.malloc(newsize*sizeof(int), mb->memctl.memory_data); if (new == NULL) return PCRE2_ERROR_NOMEMORY; @@ -2803,6 +2828,7 @@ for (;;) local_offsets = (PCRE2_SIZE *)(RWS + rws->size - rws->free); local_workspace = ((int *)local_offsets) + RWS_OVEC_OSIZE; + PCRE2_ASSERT(rws->free >= RWS_RSIZE + RWS_OVEC_OSIZE); rws->free -= RWS_RSIZE + RWS_OVEC_OSIZE; while (*endasscode == OP_ALT) endasscode += GET(endasscode, 1); @@ -2902,6 +2928,7 @@ for (;;) local_offsets = (PCRE2_SIZE *)(RWS + rws->size - rws->free); local_workspace = ((int *)local_offsets) + RWS_OVEC_OSIZE; + PCRE2_ASSERT(rws->free >= RWS_RSIZE + RWS_OVEC_OSIZE); rws->free -= RWS_RSIZE + RWS_OVEC_OSIZE; while (*endasscode == OP_ALT) endasscode += GET(endasscode, 1); @@ -2950,6 +2977,7 @@ for (;;) local_offsets = (PCRE2_SIZE *)(RWS + rws->size - rws->free); local_workspace = ((int *)local_offsets) + RWS_OVEC_RSIZE; + PCRE2_ASSERT(rws->free >= RWS_RSIZE + RWS_OVEC_RSIZE); rws->free -= RWS_RSIZE + RWS_OVEC_RSIZE; /* Check for repeating a recursion without advancing the subject @@ -3049,6 +3077,7 @@ for (;;) local_offsets = (PCRE2_SIZE *)(RWS + rws->size - rws->free); local_workspace = ((int *)local_offsets) + RWS_OVEC_OSIZE; + PCRE2_ASSERT(rws->free >= RWS_RSIZE + RWS_OVEC_OSIZE); rws->free -= RWS_RSIZE + RWS_OVEC_OSIZE; if (codevalue == OP_BRAPOSZERO) @@ -3148,6 +3177,7 @@ for (;;) local_offsets = (PCRE2_SIZE *)(RWS + rws->size - rws->free); local_workspace = ((int *)local_offsets) + RWS_OVEC_OSIZE; + PCRE2_ASSERT(rws->free >= RWS_RSIZE + RWS_OVEC_OSIZE); rws->free -= RWS_RSIZE + RWS_OVEC_OSIZE; rc = internal_dfa_match( diff --git a/src/pcre2_extuni.c b/src/pcre2_extuni.c index 91d839e..1bf1c14 100644 --- a/src/pcre2_extuni.c +++ b/src/pcre2_extuni.c @@ -57,12 +57,12 @@ support, because some compilers do not like functionless source files. */ #ifndef SUPPORT_UNICODE PCRE2_SPTR -PRIV(extuni)(uint32_t c, PCRE2_SPTR eptr, PCRE2_SPTR start_subject, +PRIV(extuni)(uint32_t c, PCRE2_SPTR eptr, PCRE2_SPTR check_subject, PCRE2_SPTR end_subject, BOOL utf, int *xcount) { (void)c; (void)eptr; -(void)start_subject; +(void)check_subject; (void)end_subject; (void)utf; (void)xcount; @@ -83,7 +83,7 @@ same behaviour. Arguments: c the first character eptr pointer to next character - start_subject pointer to start of subject + check_subject pointer to start of validated subject end_subject pointer to end of subject utf TRUE if in UTF mode xcount pointer to count of additional characters, @@ -93,7 +93,7 @@ Returns: pointer after the end of the sequence */ PCRE2_SPTR -PRIV(extuni)(uint32_t c, PCRE2_SPTR eptr, PCRE2_SPTR start_subject, +PRIV(extuni)(uint32_t c, PCRE2_SPTR eptr, PCRE2_SPTR check_subject, PCRE2_SPTR end_subject, BOOL utf, int *xcount) { BOOL was_ep_ZWJ = FALSE; @@ -124,7 +124,7 @@ while (eptr < end_subject) /* bptr is pointing to the left-hand character */ - while (bptr > start_subject) + while (bptr > check_subject) { bptr--; if (utf) diff --git a/src/pcre2_internal.h b/src/pcre2_internal.h index 6e0a5e0..3b570ea 100644 --- a/src/pcre2_internal.h +++ b/src/pcre2_internal.h @@ -1397,7 +1397,7 @@ High16 and High32: the highest bit is always one The items are ordered in increasing order, so binary search can be used to find the lower bound of an input character. The lower bound is the highest item, which value is less or equal than the input -character. If the lower bit of the item is cleard, or the character +character. If the lower bit of the item is cleared, or the character stored in the item equals to the input character, the input character is in the character list. */ @@ -1418,14 +1418,19 @@ character is in the character list. */ #define XCL_CHAR_LIST_HIGH_32_END 0xffffffff #define XCL_CHAR_LIST_HIGH_32_ADD 0x80000000 -/* Mask for getting the descriptors of character list ranges. -Each descriptor has XCL_TYPE_BIT_LEN bits, and can be processed -by XCL_BEGIN_WITH_RANGE and XCL_ITEM_COUNT_MASK macros. */ +/* Mask and length values for getting the descriptors of +all character list ranges. The bit length of each descriptor +is XCL_TYPE_BIT_LEN so the total size is 4*XCL_TYPE_BIT_LEN +(currently 12 bit). This data is stored for all four character +lists, even if no characters are present in a list. */ #define XCL_TYPE_MASK 0xfff #define XCL_TYPE_BIT_LEN 3 -/* If this bit is set, the first item of the character list is the -end of a range, which started before the starting character of the -character list. */ +/* If this bit is set for a character class, the first item of the +character list is the end of a range, which started before the +starting character of the character list. If this bit is set, and +no characters are present in the list, the whole character class +is part of a range. E.g: [\x{500}-\x{12000}] covers the entire +0x8000-0xffff range. */ #define XCL_BEGIN_WITH_RANGE 0x4 /* Number of items in the character list: 0, 1, or 2. The value 3 represents that the item count is stored at the begining of the @@ -2170,6 +2175,7 @@ is available. */ #define _pcre2_is_newline PCRE2_SUFFIX(_pcre2_is_newline_) #define _pcre2_jit_free_rodata PCRE2_SUFFIX(_pcre2_jit_free_rodata_) #define _pcre2_jit_free PCRE2_SUFFIX(_pcre2_jit_free_) +#define _pcre2_jit_check_exec PCRE2_SUFFIX(_pcre2_jit_check_exec_) #define _pcre2_jit_get_size PCRE2_SUFFIX(_pcre2_jit_get_size_) #define _pcre2_jit_get_target PCRE2_SUFFIX(_pcre2_jit_get_target_) #define _pcre2_memctl_malloc PCRE2_SUFFIX(_pcre2_memctl_malloc_) @@ -2198,6 +2204,7 @@ extern BOOL _pcre2_is_newline(PCRE2_SPTR, uint32_t, PCRE2_SPTR, uint32_t *, BOOL); extern void _pcre2_jit_free_rodata(void *, void *); extern void _pcre2_jit_free(void *, pcre2_memctl *); +extern BOOL _pcre2_jit_check_exec(void *, uint32_t); extern size_t _pcre2_jit_get_size(void *); const char * _pcre2_jit_get_target(void); extern void * _pcre2_memctl_malloc(size_t, pcre2_memctl *); diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c index 175eb68..b222684 100644 --- a/src/pcre2_jit_compile.c +++ b/src/pcre2_jit_compile.c @@ -103,7 +103,7 @@ Fast, but limited size. */ /* Growth rate for stack allocated by the OS. Should be the multiply of page size. */ -#define STACK_GROWTH_RATE 8192 +#define STACK_GROWTH_RATE (sljit_sw)8192 /* Enable to check that the allocation could destroy temporaries. */ #if defined SLJIT_DEBUG && SLJIT_DEBUG @@ -468,6 +468,8 @@ typedef struct compiler_common { BOOL local_quit_available; /* Currently in a positive assertion. */ BOOL in_positive_assertion; + /* More than STACK_GROWTH_RATE / 2 stack memory is allocated. */ + BOOL large_stack_allocation; /* Newline control. */ int nltype; sljit_u32 nlmax; @@ -3386,6 +3388,8 @@ static SLJIT_INLINE void allocate_stack(compiler_common *common, int size) DEFINE_COMPILER; SLJIT_ASSERT(size > 0); +if (size > (STACK_GROWTH_RATE / (SSIZE_OF(sw) * 2))) + common->large_stack_allocation = TRUE; OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, size * SSIZE_OF(sw)); #ifdef DESTROY_REGISTERS OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 12345); @@ -6107,6 +6111,7 @@ while (TRUE) repeat = GET2(cc, 1); if (repeat <= 0) { + repeat = 1; chars_end = chars; continue; } @@ -12230,6 +12235,8 @@ else if (SLJIT_UNLIKELY(opcode == OP_ASSERT_SCS)) if (common->restore_end_ptr == 0) common->restore_end_ptr = private_data_ptr + sizeof(sljit_sw); } +else if (SLJIT_UNLIKELY(opcode == OP_ASSERTBACK_NA) && PRIVATE_DATA(ccbegin + 1)) + OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); if (SLJIT_UNLIKELY(opcode == OP_ONCE)) { @@ -13765,7 +13772,20 @@ SLJIT_ASSERT(TMP1 == SLJIT_R0 && STR_PTR == SLJIT_R1); OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCAL1, STR_PTR, 0); OP1(SLJIT_MOV, SLJIT_R0, 0, ARGUMENTS, 0); -OP2(SLJIT_SUB, SLJIT_R1, 0, STACK_LIMIT, 0, SLJIT_IMM, STACK_GROWTH_RATE); +if (common->large_stack_allocation) + { + SLJIT_COMPILE_ASSERT((STACK_GROWTH_RATE & (STACK_GROWTH_RATE - 1)) == 0, stack_growth_must_be_power_of_2); + // Negative difference. The positive difference would also use the same amount + // of operations, but the last subtraction emits several instructions on x86. + OP2(SLJIT_SUB, SLJIT_R1, 0, STACK_TOP, 0, STACK_LIMIT, 0); + // Minimum extra space after allocation. + OP2(SLJIT_SUB, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, (STACK_GROWTH_RATE / 2)); + // Rounds down negative numbers. + OP2(SLJIT_AND, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, ~(STACK_GROWTH_RATE - 1)); + OP2(SLJIT_ADD, SLJIT_R1, 0, SLJIT_R1, 0, STACK_LIMIT, 0); + } +else + OP2(SLJIT_SUB, SLJIT_R1, 0, STACK_LIMIT, 0, SLJIT_IMM, STACK_GROWTH_RATE); OP1(SLJIT_MOV, SLJIT_R0, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, stack)); OP1(SLJIT_MOV, STACK_LIMIT, 0, TMP2, 0); diff --git a/src/pcre2_jit_match.c b/src/pcre2_jit_match.c index 8867f76..6afc6d9 100644 --- a/src/pcre2_jit_match.c +++ b/src/pcre2_jit_match.c @@ -118,6 +118,7 @@ jit_arguments arguments; int rc; int index = 0; +/* The same check is performed by jit_check_exec(). */ if ((options & PCRE2_PARTIAL_HARD) != 0) index = 2; else if ((options & PCRE2_PARTIAL_SOFT) != 0) @@ -126,6 +127,16 @@ else if ((options & PCRE2_PARTIAL_SOFT) != 0) if (functions == NULL || functions->executable_funcs[index] == NULL) return PCRE2_ERROR_JIT_BADOPTION; +/* If the match data block was previously used with PCRE2_COPY_MATCHED_SUBJECT, +free the memory that was obtained. */ + +if ((match_data->flags & PCRE2_MD_COPIED_SUBJECT) != 0) + { + match_data->memctl.free((void *)match_data->subject, + match_data->memctl.memory_data); + match_data->flags &= ~PCRE2_MD_COPIED_SUBJECT; + } + /* Sanity checks should be handled by pcre2_match. */ arguments.str = subject + start_offset; arguments.begin = subject; diff --git a/src/pcre2_jit_misc.c b/src/pcre2_jit_misc.c index c3abc0b..2045232 100644 --- a/src/pcre2_jit_misc.c +++ b/src/pcre2_jit_misc.c @@ -214,6 +214,32 @@ return sljit_get_platform_name(); } +/************************************************* +* Checks function compilation * +*************************************************/ + +BOOL +PRIV(jit_check_exec)(void *executable_jit, uint32_t options) +{ +#ifndef SUPPORT_JIT +(void)executable_jit; +(void)options; +return FALSE; +#else /* SUPPORT_JIT */ +/* The same check is performed at the beginning of pcre2_jit_match(). */ +executable_functions *functions = (executable_functions *)executable_jit; +int index = 0; + +if ((options & PCRE2_PARTIAL_HARD) != 0) + index = 2; +else if ((options & PCRE2_PARTIAL_SOFT) != 0) + index = 1; + +return functions->executable_funcs[index] != NULL; +#endif +} + + /************************************************* * Get size of JIT code * *************************************************/ diff --git a/src/pcre2_jit_test.c b/src/pcre2_jit_test.c index a7ade44..8344c44 100644 --- a/src/pcre2_jit_test.c +++ b/src/pcre2_jit_test.c @@ -277,6 +277,7 @@ static struct regression_test_case regression_test_cases[] = { { CM, A, 0, 0, "a1277|a1377|bx487", "bX487" }, { 0, A, 0, 0, "(a|)b*+a", "a" }, { 0, A, 0, 0 | F_NOMATCH, "(.|.|.|.|.)(|.|.|.|.)(.||.|.|.)(.|.||.|.)(.|.|.||.)(.|.|.|.|)(A|.|.|.|.)(.|A|.|.|.)(.|.|A|.|.)(.|.|.|A|.)(.|.|.|.|A)(B|.|.|.|.)(.|B|.|.|.)(.|.|B|.|.)(.|.|.|B|.)(.|.|.|.|B)xa", "1234567890123456ax" }, + { 0, A, 0, 0, "(CHAN|LINE)[ab]{0,2}", "LINE" }, /* Greedy and non-greedy ? operators. */ { MU, A, 0, 0, "(?:a)?a", "laab" }, @@ -651,6 +652,7 @@ static struct regression_test_case regression_test_cases[] = { { MU, A, 0, 0, "a(?=)b", "ab" }, { MU, A, 0, 0 | F_NOMATCH, "a(?!)b", "ab" }, { MU, A, 0, 0, "(?(?start_code, *Fecode, else { GETCHARINCTEST(fc, Feptr); - Feptr = PRIV(extuni)(fc, Feptr, mb->start_subject, mb->end_subject, utf, + Feptr = PRIV(extuni)(fc, Feptr, mb->check_subject, mb->end_subject, utf, NULL); } CHECK_PARTIAL(); @@ -3151,7 +3151,7 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode, else { GETCHARINCTEST(fc, Feptr); - Feptr = PRIV(extuni)(fc, Feptr, mb->start_subject, + Feptr = PRIV(extuni)(fc, Feptr, mb->check_subject, mb->end_subject, utf, NULL); } CHECK_PARTIAL(); @@ -3969,7 +3969,7 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode, else { GETCHARINCTEST(fc, Feptr); - Feptr = PRIV(extuni)(fc, Feptr, mb->start_subject, mb->end_subject, + Feptr = PRIV(extuni)(fc, Feptr, mb->check_subject, mb->end_subject, utf, NULL); } CHECK_PARTIAL(); @@ -4552,7 +4552,7 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode, else { GETCHARINCTEST(fc, Feptr); - Feptr = PRIV(extuni)(fc, Feptr, mb->start_subject, mb->end_subject, + Feptr = PRIV(extuni)(fc, Feptr, mb->check_subject, mb->end_subject, utf, NULL); } CHECK_PARTIAL(); @@ -6123,7 +6123,7 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode, { for (i = 0; i < Lmax; i++) { - if (Feptr == mb->start_subject) + if (Feptr <= mb->check_subject) { if (i < Lmin) RRETURN(MATCH_NOMATCH); Lmax = i; @@ -6867,10 +6867,6 @@ PCRE2_SPTR req_cu_ptr; PCRE2_SPTR start_partial; PCRE2_SPTR match_partial; -#ifdef SUPPORT_JIT -BOOL use_jit; -#endif - /* This flag is needed even when Unicode is not supported for convenience (it is used by the IS_NEWLINE macro). */ @@ -6880,9 +6876,6 @@ BOOL utf = FALSE; BOOL ucp = FALSE; BOOL allow_invalid; uint32_t fragment_options = 0; -#ifdef SUPPORT_JIT -BOOL jit_checked_utf = FALSE; -#endif #endif /* SUPPORT_UNICODE */ PCRE2_SIZE frame_size; @@ -6943,15 +6936,6 @@ options |= (re->flags & FF) / ((FF & (~FF+1)) / (OO & (~OO+1))); #undef FF #undef OO -/* If the pattern was successfully studied with JIT support, we will run the -JIT executable instead of the rest of this function. Most options must be set -at compile time for the JIT code to be usable. */ - -#ifdef SUPPORT_JIT -use_jit = (re->executable_jit != NULL && - (options & ~PUBLIC_JIT_MATCH_OPTIONS) == 0); -#endif - /* Initialize UTF/UCP parameters. */ #ifdef SUPPORT_UNICODE @@ -6997,20 +6981,25 @@ match_data->startchar = 0; /* ============================= JIT matching ============================== */ -/* Prepare for JIT matching. Check a UTF string for validity unless no check is -requested or invalid UTF can be handled. We check only the portion of the -subject that might be be inspected during matching - from the offset minus the -maximum lookbehind to the given length. This saves time when a small part of a -large subject is being matched by the use of a starting offset. Note that the -maximum lookbehind is a number of characters, not code units. */ +/* If the pattern was successfully studied with JIT support, we will run the +JIT executable instead of the rest of this function. Most options must be set +at compile time for the JIT code to be usable. */ #ifdef SUPPORT_JIT -if (use_jit) +if (re->executable_jit != NULL && + (options & ~PUBLIC_JIT_MATCH_OPTIONS) == 0 && + PRIV(jit_check_exec)(re->executable_jit, options)) { + /* Prepare for JIT matching. Check a UTF string for validity unless no check + is requested or invalid UTF can be handled. We check only the portion of the + subject that might be be inspected during matching - from the offset minus + the maximum lookbehind to the given length. This saves time when a small part + of a large subject is being matched by the use of a starting offset. Note that + the maximum lookbehind is a number of characters, not code units. */ + #ifdef SUPPORT_UNICODE if (utf && (options & PCRE2_NO_UTF_CHECK) == 0 && !allow_invalid) { - /* For 8-bit and 16-bit UTF, check that the first code unit is a valid character start. */ @@ -7063,16 +7052,14 @@ if (use_jit) match_data->startchar += start_match - subject; return match_data->rc; } - jit_checked_utf = TRUE; } #endif /* SUPPORT_UNICODE */ - /* If JIT returns BADOPTION, which means that the selected complete or - partial matching mode was not compiled, fall through to the interpreter. */ - rc = pcre2_jit_match(code, subject, length, start_offset, options, match_data, mcontext); - if (rc != PCRE2_ERROR_JIT_BADOPTION) + /* JIT must be able to perform the match. */ + PCRE2_ASSERT(rc != PCRE2_ERROR_JIT_BADOPTION); + { match_data->subject_length = length; if (rc >= 0 && (options & PCRE2_COPY_MATCHED_SUBJECT) != 0) @@ -7098,12 +7085,8 @@ this. */ mb->check_subject = subject; -/* If a UTF subject string was not checked for validity in the JIT code above, -check it here, and handle support for invalid UTF strings. The check above -happens only when invalid UTF is not supported and PCRE2_NO_CHECK_UTF is unset. -If we get here in those circumstances, it means the subject string is valid, -but for some reason JIT matching was not successful. There is no need to check -the subject again. +/* Check the validity of UTF subject strings. The check happens only when +PCRE2_NO_CHECK_UTF is unset. We check only the portion of the subject that might be be inspected during matching - from the offset minus the maximum lookbehind to the given length. @@ -7115,11 +7098,7 @@ Note also that support for invalid UTF forces a check, overriding the setting of PCRE2_NO_CHECK_UTF. */ #ifdef SUPPORT_UNICODE -if (utf && -#ifdef SUPPORT_JIT - !jit_checked_utf && -#endif - ((options & PCRE2_NO_UTF_CHECK) == 0 || allow_invalid)) +if (utf && ((options & PCRE2_NO_UTF_CHECK) == 0 || allow_invalid)) { #if PCRE2_CODE_UNIT_WIDTH != 32 BOOL skipped_bad_start = FALSE; diff --git a/src/pcre2_pattern_info.c b/src/pcre2_pattern_info.c index fe4d3c6..c49eaf6 100644 --- a/src/pcre2_pattern_info.c +++ b/src/pcre2_pattern_info.c @@ -292,8 +292,7 @@ if (re->magic_number != MAGIC_NUMBER) return PCRE2_ERROR_BADMAGIC; if ((re->flags & (PCRE2_CODE_UNIT_WIDTH/8)) == 0) return PCRE2_ERROR_BADMODE; cb.version = 0; -cc = (PCRE2_SPTR)((const uint8_t *)re + sizeof(pcre2_real_code)) - + re->name_count * re->name_entry_size; +cc = (PCRE2_SPTR)((uint8_t *)re + re->code_start); while (TRUE) { diff --git a/src/pcre2_substring.c b/src/pcre2_substring.c index 88afd23..aabab28 100644 --- a/src/pcre2_substring.c +++ b/src/pcre2_substring.c @@ -214,9 +214,10 @@ PCRE2_SIZE size; PCRE2_UCHAR *yield; rc = pcre2_substring_length_bynumber(match_data, stringnumber, &size); if (rc < 0) return rc; -yield = PRIV(memctl_malloc)(sizeof(pcre2_memctl) + - (size + 1)*PCRE2_CODE_UNIT_WIDTH, (pcre2_memctl *)match_data); -if (yield == NULL) return PCRE2_ERROR_NOMEMORY; +if (size > ((PCRE2_SIZE_MAX - sizeof(pcre2_memctl)) / CU2BYTES(1)) - 1 || + (yield = PRIV(memctl_malloc)(sizeof(pcre2_memctl) + + CU2BYTES(size + 1), (pcre2_memctl *)match_data)) == NULL) + return PCRE2_ERROR_NOMEMORY; yield = (PCRE2_UCHAR *)(((char *)yield) + sizeof(pcre2_memctl)); memcpy(yield, match_data->subject + match_data->ovector[stringnumber*2], CU2BYTES(size)); diff --git a/src/pcre2test.c b/src/pcre2test.c index 80ab4f8..199bdff 100644 --- a/src/pcre2test.c +++ b/src/pcre2test.c @@ -512,7 +512,6 @@ so many of them that they are split into two fields. */ /* Combinations */ #define CTL_DEBUG (CTL_FULLBINCODE|CTL_INFO) /* For setting */ -#define CTL_ANYINFO (CTL_DEBUG|CTL_BINCODE|CTL_CALLOUT_INFO) #define CTL_ANYGLOB (CTL_ALTGLOBAL|CTL_GLOBAL) /* Second control word */ @@ -4652,6 +4651,16 @@ fprintf(outfile, "%.*s\n", return 0; } +/* Backport from 10.47 */ + +static int callout_enumerate_function_void(pcre2_callout_enumerate_block_8 *cb, + void *callout_data) +{ +(void)cb; +(void)callout_data; +return 0; +} + /************************************************* @@ -4671,9 +4680,16 @@ Returns: PR_OK continue processing next line static int show_pattern_info(void) { +int rc_enum; uint32_t compile_options, overall_options, extra_options; BOOL utf = (FLD(compiled_code, overall_options) & PCRE2_UTF) != 0; +if ((pat_patctl.control & CTL_MEMORY) != 0) + show_memory_info(); + +if ((pat_patctl.control2 & CTL2_FRAMESIZE) != 0) + show_framesize(); + if ((pat_patctl.control & (CTL_BINCODE|CTL_FULLBINCODE)) != 0) { fprintf(outfile, "------------------------------------------------------------------\n"); @@ -5016,17 +5032,17 @@ if ((pat_patctl.control & CTL_INFO) != 0) } } -if ((pat_patctl.control & CTL_CALLOUT_INFO) != 0) +PCRE2_CALLOUT_ENUMERATE(rc_enum, + (((pat_patctl.control & CTL_CALLOUT_INFO) != 0)? callout_callback : + /* Exercise the callout enumeration code with a dummy callback to make sure + it works. */ + callout_enumerate_function_void), 0); +if (rc_enum != 0) { - int errorcode; - PCRE2_CALLOUT_ENUMERATE(errorcode, callout_callback, 0); - if (errorcode != 0) - { - fprintf(outfile, "Callout enumerate failed: error %d: ", errorcode); - if (errorcode < 0 && !print_error_message(errorcode, "", "\n")) - return PR_ABEND; - return PR_SKIP; - } + fprintf(outfile, "Callout enumerate failed: error %d: ", rc_enum); + if (rc_enum < 0 && !print_error_message(rc_enum, "", "\n")) + return PR_ABEND; + return PR_SKIP; } return PR_OK; @@ -5230,13 +5246,9 @@ switch(cmd) { PCRE2_JIT_COMPILE(jitrc, compiled_code, pat_patctl.jit); } - if ((pat_patctl.control & CTL_MEMORY) != 0) show_memory_info(); - if ((pat_patctl.control2 & CTL2_FRAMESIZE) != 0) show_framesize(); - if ((pat_patctl.control & CTL_ANYINFO) != 0) - { - rc = show_pattern_info(); - if (rc != PR_OK) return rc; - } + + rc = show_pattern_info(); + if (rc != PR_OK) return rc; break; /* Save the stack of compiled patterns to a file, then empty the stack. */ @@ -5395,13 +5407,17 @@ BOOL utf; uint32_t k; uint8_t *p = buffer; unsigned int delimiter = *p++; -int errorcode; +int rc, errorcode; void *use_pat_context; void *use_pbuffer = NULL; uint32_t use_forbid_utf = forbid_utf; PCRE2_SIZE patlen; PCRE2_SIZE valgrind_access_length; PCRE2_SIZE erroroffset; +int32_t serialize_rc; +void *serialize_code; +uint8_t *serialized_bytes; +PCRE2_SIZE serialized_size; /* The perltest.sh script supports only / as a delimiter. */ @@ -5724,7 +5740,6 @@ local character tables. Neither does it have 16-bit or 32-bit support. */ if ((pat_patctl.control & CTL_POSIX) != 0) { #ifdef SUPPORT_PCRE2_8 - int rc; int cflags = 0; const char *msg = "** Ignored with POSIX interface:"; #endif @@ -5931,7 +5946,6 @@ ends up back in the usual place. */ if (pat_patctl.convert_type != CONVERT_UNSET) { - int rc; int convert_return = PR_OK; uint32_t convert_options = pat_patctl.convert_type; void *converted_pattern; @@ -6246,14 +6260,32 @@ if ((pat_patctl.control2 & CTL2_NL_SET) != 0) /* Output code size and other information if requested. */ -if ((pat_patctl.control & CTL_MEMORY) != 0) show_memory_info(); -if ((pat_patctl.control2 & CTL2_FRAMESIZE) != 0) show_framesize(); -if ((pat_patctl.control & CTL_ANYINFO) != 0) +rc = show_pattern_info(); +if (rc != PR_OK) return rc; + +/* Verify that the compiled structure can be serialized without generating +memory errors. */ + +serialize_code = PTR(compiled_code); +PCRE2_SERIALIZE_ENCODE(serialize_rc, &serialize_code, 1, &serialized_bytes, + &serialized_size, general_context); +if (serialize_rc != 1) { - int rc = show_pattern_info(); - if (rc != PR_OK) return rc; + fprintf(outfile, "** pcre2_serialize_encode() returned %d instead of 1\n", + serialize_rc); + return PR_ABEND; } +#if defined SUPPORT_VALGRIND +if (VALGRIND_CHECK_MEM_IS_DEFINED(serialized_bytes, serialized_size) != 0) + { + fprintf(outfile, "** pcre2_serialize_encode() returned undefined data\n"); + return PR_ABEND; + } +#endif + +PCRE2_SERIALIZE_FREE(serialized_bytes); + /* The "push" control requests that the compiled pattern be remembered on a stack. This is mainly for testing the serialization functionality. */ @@ -6389,7 +6421,8 @@ for (;;) PTR(dat_context), dfa_workspace, DFA_WS_DIMENSION); } - else if ((pat_patctl.control & CTL_JITFAST) != 0) + else if ((pat_patctl.control & CTL_JITFAST) != 0 && + (dat_datctl.options & PCRE2_NO_JIT) == 0) PCRE2_JIT_MATCH(capcount, compiled_code, pp, ulen, dat_datctl.offset, dat_datctl.options, match_data, PTR(dat_context)); @@ -7989,7 +8022,8 @@ if (dat_datctl.replacement[0] != 0) if (emoption != 0) { - if ((pat_patctl.control & CTL_JITFAST) != 0) + if ((pat_patctl.control & CTL_JITFAST) != 0 && + (dat_datctl.options & PCRE2_NO_JIT) == 0) { PCRE2_JIT_MATCH(rc, compiled_code, pp, arg_ulen, dat_datctl.offset, dat_datctl.options, match_data, use_dat_context); @@ -8208,7 +8242,8 @@ for (gmatched = 0;; gmatched++) } } - else if ((pat_patctl.control & CTL_JITFAST) != 0) + else if ((pat_patctl.control & CTL_JITFAST) != 0 && + (dat_datctl.options & PCRE2_NO_JIT) == 0) { start_time = clock(); for (i = 0; i < timeitm; i++) @@ -8305,7 +8340,8 @@ for (gmatched = 0;; gmatched++) } else { - if ((pat_patctl.control & CTL_JITFAST) != 0) + if ((pat_patctl.control & CTL_JITFAST) != 0 && + (dat_datctl.options & PCRE2_NO_JIT) == 0) PCRE2_JIT_MATCH(capcount, compiled_code, pp, arg_ulen, dat_datctl.offset, dat_datctl.options | g_notempty, match_data, use_dat_context); else @@ -8353,20 +8389,29 @@ for (gmatched = 0;; gmatched++) /* If PCRE2_COPY_MATCHED_SUBJECT was set, check that things are as they should be, but not for fast JIT, where it isn't supported. */ - if ((dat_datctl.options & PCRE2_COPY_MATCHED_SUBJECT) != 0 && - (pat_patctl.control & CTL_JITFAST) == 0) + if ((dat_datctl.options & PCRE2_COPY_MATCHED_SUBJECT) != 0) { - if ((FLD(match_data, flags) & PCRE2_MD_COPIED_SUBJECT) == 0) - fprintf(outfile, - "** PCRE2 error: flag not set after copy_matched_subject\n"); + if ((pat_patctl.control & CTL_JITFAST) != 0 && + (dat_datctl.options & PCRE2_NO_JIT) == 0) + { + if ((FLD(match_data, flags) & PCRE2_MD_COPIED_SUBJECT) != 0) + fprintf(outfile, + "** PCRE2 error: flag set after unsupported copy_matched_subject\n"); + } + else + { + if ((FLD(match_data, flags) & PCRE2_MD_COPIED_SUBJECT) == 0) + fprintf(outfile, + "** PCRE2 error: flag not set after copy_matched_subject\n"); - if (CASTFLD(const void *, match_data, subject) == pp) - fprintf(outfile, - "** PCRE2 error: copy_matched_subject has not copied\n"); + if (CASTFLD(const void *, match_data, subject) == pp) + fprintf(outfile, + "** PCRE2 error: copy_matched_subject has not copied\n"); - if (memcmp(CASTFLD(const void *, match_data, subject), pp, ulen) != 0) - fprintf(outfile, - "** PCRE2 error: copy_matched_subject mismatch\n"); + if (memcmp(CASTFLD(const void *, match_data, subject), pp, ulen) != 0) + fprintf(outfile, + "** PCRE2 error: copy_matched_subject mismatch\n"); + } } /* If this is not the first time round a global loop, check that the diff --git a/testdata/testinput10 b/testdata/testinput10 index 3309f5e..a7d30b2 100644 --- a/testdata/testinput10 +++ b/testdata/testinput10 @@ -573,6 +573,16 @@ AAA\x80BXYZ AAA\x80BBXYZ +# Backward scans must not enter the invalid prefix before check_subject. + +/(?<=a{1,2})X/utf,match_invalid_utf +\= Expect no match + \x80X + +/\X\X/utf,match_invalid_utf +\= Expect no match + \x80\x{1f1e6}\x{1f1e7} + # ------------------------------------- /(*UTF)(?=\x{123})/I diff --git a/testdata/testinput12 b/testdata/testinput12 index 9763f73..b789b00 100644 --- a/testdata/testinput12 +++ b/testdata/testinput12 @@ -486,6 +486,16 @@ /(..)(*scs:(1)ab$)/match_invalid_utf ab\x{df00}cde +# Backward scans must not enter the invalid prefix before check_subject. + +/(?<=a{1,2})X/utf,match_invalid_utf +\= Expect no match + \x{dc00}X + +/\X\X/utf,match_invalid_utf +\= Expect no match + \x{dc00}\x{1f1e6}\x{1f1e7} + # ---------------------------------------------------- /(*UTF)(?=\x{123})/I diff --git a/testdata/testinput17 b/testdata/testinput17 index 7dd2d8e..c396e8e 100644 --- a/testdata/testinput17 +++ b/testdata/testinput17 @@ -294,8 +294,13 @@ /abc/jitfast abc + abc\=copy_matched_subject abc\=no_jit - + +/abc/jitfast + abc\=copy_matched_subject,no_jit + abc + # ---- /[aC]/mg,firstline,newline=lf @@ -313,4 +318,12 @@ /(...)-(...)/jitfast abc-xyz\=get=2 +# Commented-out test; please re-enable and run manually on Unicode builds +# #if unicode +# +# /\b/B,utf,ucp,jit=1 +# \xff\x00\x00\=offset=2,ps +# +# #endif + # End of testinput17 diff --git a/testdata/testinput5 b/testdata/testinput5 index a0d2cd5..fdae163 100644 --- a/testdata/testinput5 +++ b/testdata/testinput5 @@ -2882,6 +2882,12 @@ /([\x{6535}\x{6536}\x{6538}\x{6539}\x{653b}\x{653c}\x{653e}\x{653f}\x{6541}\x{6542}\x{8000}-\x{ffff}]#)+/B,utf \x{6534}#\x{6537}#\x{653a}#\x{653d}#\x{6540}#\x{6543}#\x{7fff}#\x{6535}#\x{6536}#\x{6538}#\x{6539}#\x{653b}#\x{653c}#\x{653e}#\x{653f}#\x{6541}#\x{6542}#\x{8000}#\x{c246}#\x{ffff} +/[\x{ff}\x{100}\x{8000}\x{8002}\x{8004}\x{8006}\x{8008}\x{800a}\x{800c}\x{800e}]+/B,utf + \x{ff}\x{100}\x{8000}\x{800a}\x{800e}\x{101} + +/[\x{ff}-\x{104}\x{8000}\x{8002}\x{8004}\x{8006}\x{8008}\x{800a}\x{800c}\x{800e}]+/B,utf + \x{ff}\x{100}\x{101}\x{104}\x{8000}\x{800a}\x{800e}\x{105} + /[[:xdigit:]\x{400}-\x{600}]+/utf,ucp !a0\x{400}\x{600}9\x{3ff} diff --git a/testdata/testinput6 b/testdata/testinput6 index 1fbe4ce..8b75c79 100644 --- a/testdata/testinput6 +++ b/testdata/testinput6 @@ -5200,4 +5200,9 @@ # -------------- +# Test workspace resizing and workspace re-use + +/(*LIMIT_HEAP=4)(?=(?=(?=(?=(?=(?=(?=(?=a))(?R)))))))./ + a\=dfa + # End of testinput6 diff --git a/testdata/testoutput10 b/testdata/testoutput10 index d1bccf3..9b5b670 100644 --- a/testdata/testoutput10 +++ b/testdata/testoutput10 @@ -1745,6 +1745,18 @@ No match AAA\x80BBXYZ No match +# Backward scans must not enter the invalid prefix before check_subject. + +/(?<=a{1,2})X/utf,match_invalid_utf +\= Expect no match + \x80X +No match + +/\X\X/utf,match_invalid_utf +\= Expect no match + \x80\x{1f1e6}\x{1f1e7} +No match + # ------------------------------------- /(*UTF)(?=\x{123})/I diff --git a/testdata/testoutput12-16 b/testdata/testoutput12-16 index bd4d524..64a7dd8 100644 --- a/testdata/testoutput12-16 +++ b/testdata/testoutput12-16 @@ -1626,6 +1626,18 @@ No match 0: ab 1: ab +# Backward scans must not enter the invalid prefix before check_subject. + +/(?<=a{1,2})X/utf,match_invalid_utf +\= Expect no match + \x{dc00}X +No match + +/\X\X/utf,match_invalid_utf +\= Expect no match + \x{dc00}\x{1f1e6}\x{1f1e7} +No match + # ---------------------------------------------------- /(*UTF)(?=\x{123})/I diff --git a/testdata/testoutput12-32 b/testdata/testoutput12-32 index c9587ee..00133e2 100644 --- a/testdata/testoutput12-32 +++ b/testdata/testoutput12-32 @@ -1624,6 +1624,18 @@ No match 0: ab 1: ab +# Backward scans must not enter the invalid prefix before check_subject. + +/(?<=a{1,2})X/utf,match_invalid_utf +\= Expect no match + \x{dc00}X +No match + +/\X\X/utf,match_invalid_utf +\= Expect no match + \x{dc00}\x{1f1e6}\x{1f1e7} +No match + # ---------------------------------------------------- /(*UTF)(?=\x{123})/I diff --git a/testdata/testoutput17 b/testdata/testoutput17 index 95f3959..e7334e4 100644 --- a/testdata/testoutput17 +++ b/testdata/testoutput17 @@ -538,10 +538,18 @@ Failed: error -47: match limit exceeded /abc/jitfast abc + 0: abc (JIT) + abc\=copy_matched_subject 0: abc (JIT) abc\=no_jit 0: abc (JIT) - + +/abc/jitfast + abc\=copy_matched_subject,no_jit + 0: abc (JIT) + abc + 0: abc (JIT) + # ---- /[aC]/mg,firstline,newline=lf @@ -567,4 +575,12 @@ Failed: error -47: match limit exceeded 2: xyz 2G xyz (3) +# Commented-out test; please re-enable and run manually on Unicode builds +# #if unicode +# +# /\b/B,utf,ucp,jit=1 +# \xff\x00\x00\=offset=2,ps +# +# #endif + # End of testinput17 diff --git a/testdata/testoutput5 b/testdata/testoutput5 index 73d484c..02540df 100644 --- a/testdata/testoutput5 +++ b/testdata/testoutput5 @@ -6254,6 +6254,26 @@ Failed: error 115 at offset 52: reference to non-existent subpattern 0: \x{6535}#\x{6536}#\x{6538}#\x{6539}#\x{653b}#\x{653c}#\x{653e}#\x{653f}#\x{6541}#\x{6542}#\x{8000}#\x{c246}# 1: \x{c246}# +/[\x{ff}\x{100}\x{8000}\x{8002}\x{8004}\x{8006}\x{8008}\x{800a}\x{800c}\x{800e}]+/B,utf +------------------------------------------------------------------ + Bra + [\xff\x{100}\x{8000}\x{8002}\x{8004}\x{8006}\x{8008}\x{800a}\x{800c}\x{800e}]++ + Ket + End +------------------------------------------------------------------ + \x{ff}\x{100}\x{8000}\x{800a}\x{800e}\x{101} + 0: \x{ff}\x{100}\x{8000}\x{800a}\x{800e} + +/[\x{ff}-\x{104}\x{8000}\x{8002}\x{8004}\x{8006}\x{8008}\x{800a}\x{800c}\x{800e}]+/B,utf +------------------------------------------------------------------ + Bra + [\xff\x{100}-\x{104}\x{8000}\x{8002}\x{8004}\x{8006}\x{8008}\x{800a}\x{800c}\x{800e}]++ + Ket + End +------------------------------------------------------------------ + \x{ff}\x{100}\x{101}\x{104}\x{8000}\x{800a}\x{800e}\x{105} + 0: \x{ff}\x{100}\x{101}\x{104}\x{8000}\x{800a}\x{800e} + /[[:xdigit:]\x{400}-\x{600}]+/utf,ucp !a0\x{400}\x{600}9\x{3ff} 0: a0\x{400}\x{600}9 diff --git a/testdata/testoutput6 b/testdata/testoutput6 index 74c40e9..802bd84 100644 --- a/testdata/testoutput6 +++ b/testdata/testoutput6 @@ -8164,4 +8164,10 @@ No match # -------------- +# Test workspace resizing and workspace re-use + +/(*LIMIT_HEAP=4)(?=(?=(?=(?=(?=(?=(?=(?=a))(?R)))))))./ + a\=dfa +Failed: error -63: heap limit exceeded + # End of testinput6