From e17beef6eded1ea8be8d91999a8d819a0e5a143f Mon Sep 17 00:00:00 2001 From: y30009332 Date: Wed, 19 Apr 2023 20:01:12 +0800 Subject: [PATCH] sync community patchs --- ...n-ffcps_-if-subject-shorter-than-off.patch | 36 +++++++++++++++++ ...t_free_unused_memory-if-sljit-not-us.patch | 39 +++++++++++++++++++ pcre2.spec | 9 ++++- 3 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 backport-jit-fail-early-in-ffcps_-if-subject-shorter-than-off.patch create mode 100644 backport-jit-fix-pcre2_jit_free_unused_memory-if-sljit-not-us.patch diff --git a/backport-jit-fail-early-in-ffcps_-if-subject-shorter-than-off.patch b/backport-jit-fail-early-in-ffcps_-if-subject-shorter-than-off.patch new file mode 100644 index 0000000..363a1d7 --- /dev/null +++ b/backport-jit-fail-early-in-ffcps_-if-subject-shorter-than-off.patch @@ -0,0 +1,36 @@ +From f2411acb3711a44497539d17b245bd366d9c26d7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= +Date: Mon, 12 Dec 2022 08:32:42 -0800 +Subject: [PATCH] jit: fail early in ffcps_* if subject shorter than offs1 + (#175) + +FF_FUN would try loading a vector from an invalid address +triggering a crash. + +Add the same check that is done in the x86/s390x implementations +and that was missing from the original code. + +Fixes: #86 + +Conflict:NA +Reference:https://github.com/PCRE2Project/pcre2/commit/f2411acb3711a44497539d17b245bd366d9c26d7 +--- + src/pcre2_jit_neon_inc.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/pcre2_jit_neon_inc.h b/src/pcre2_jit_neon_inc.h +index e74adf1..165602e 100644 +--- a/src/pcre2_jit_neon_inc.h ++++ b/src/pcre2_jit_neon_inc.h +@@ -183,6 +183,8 @@ restart:; + #endif + + #if defined(FFCPS) ++if (str_ptr >= str_end) ++ return NULL; + sljit_u8 *p1 = str_ptr - diff; + #endif + sljit_s32 align_offset = ((uint64_t)str_ptr & 0xf); +-- +1.8.3.1 + diff --git a/backport-jit-fix-pcre2_jit_free_unused_memory-if-sljit-not-us.patch b/backport-jit-fix-pcre2_jit_free_unused_memory-if-sljit-not-us.patch new file mode 100644 index 0000000..2991c30 --- /dev/null +++ b/backport-jit-fix-pcre2_jit_free_unused_memory-if-sljit-not-us.patch @@ -0,0 +1,39 @@ +From 7846880d63cf4b0d0d861659e222cce9c597c914 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= +Date: Thu, 1 Dec 2022 01:40:01 -0800 +Subject: [PATCH] jit: fix pcre2_jit_free_unused_memory() if sljit not using + allocator (#165) + +sljit allows building without an internal allocator, but instead using +an external one. + +make sure to only invoke the corresponding sljit call if an internal +allocator is in use (the default and as coded in pcre integration) to +avoid problems if the code is changed to use an external allocator +instead. + +Conflict:NA +Reference:https://github.com/PCRE2Project/pcre2/commit/7846880d63cf4b0d0d861659e222cce9c597c914 +--- + src/pcre2_jit_misc.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/pcre2_jit_misc.c b/src/pcre2_jit_misc.c +index e57afad..bb6a558 100644 +--- a/src/pcre2_jit_misc.c ++++ b/src/pcre2_jit_misc.c +@@ -110,8 +110,10 @@ pcre2_jit_free_unused_memory(pcre2_general_context *gcontext) + (void)gcontext; /* Suppress warning */ + #else /* SUPPORT_JIT */ + SLJIT_UNUSED_ARG(gcontext); ++#if (defined SLJIT_EXECUTABLE_ALLOCATOR && SLJIT_EXECUTABLE_ALLOCATOR) + sljit_free_unused_memory_exec(); +-#endif /* SUPPORT_JIT */ ++#endif /* SLJIT_EXECUTABLE_ALLOCATOR */ ++#endif /* SUPPORT_JIT */ + } + + +-- +1.8.3.1 + diff --git a/pcre2.spec b/pcre2.spec index fee524c..9d80031 100644 --- a/pcre2.spec +++ b/pcre2.spec @@ -1,6 +1,6 @@ Name: pcre2 Version: 10.35 -Release: 3 +Release: 4 Summary: Perl Compatible Regular Expressions License: BSD URL: http://www.pcre.org/ @@ -33,6 +33,8 @@ Patch6016: backport-match-avoid-crash-if-subject-NULL-and-PCRE2_ZERO_TER.pat Patch6017: backport-Fix-recursion-issue-in-JIT.patch Patch6018: backport-Fixed-race-condition-that-occurs-when-initializing-t.patch Patch6019: backport-Fixed-an-issue-in-the-backtracking-optimization-of-c.patch +Patch6020: backport-jit-fail-early-in-ffcps_-if-subject-shorter-than-off.patch +Patch6021: backport-jit-fix-pcre2_jit_free_unused_memory-if-sljit-not-us.patch BuildRequires: autoconf libtool automake coreutils gcc make readline-devel Obsoletes: pcre2-utf16 pcre2-utf32 pcre2-tools @@ -149,6 +151,11 @@ make check %{_pkgdocdir}/html/ %changelog +* Wed Apr 19 2023 yangmingtai - 10.35-4 +- DESC:sync community patches + backport-jit-fail-early-in-ffcps_-if-subject-shorter-than-off.patch + backport-jit-fix-pcre2_jit_free_unused_memory-if-sljit-not-us.patch + * Tue Oct 18 2022 yangmingtai - 10.35-3 - DESC:sync community patchs -- Gitee