sync community patches

This commit is contained in:
y30009332 2023-03-16 11:10:19 +08:00 committed by yangmingtai
parent ea1e5a2ff9
commit 99fbd59cb5
3 changed files with 81 additions and 1 deletions

View File

@ -0,0 +1,36 @@
From f2411acb3711a44497539d17b245bd366d9c26d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= <carenas@gmail.com>
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

View File

@ -0,0 +1,39 @@
From 7846880d63cf4b0d0d861659e222cce9c597c914 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= <carenas@gmail.com>
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

View File

@ -1,6 +1,6 @@
Name: pcre2
Version: 10.40
Release: 2
Release: 3
Summary: Perl Compatible Regular Expressions
License: BSD
URL: http://www.pcre.org/
@ -14,6 +14,8 @@ Patch6012: backport-Fixed-race-condition-that-occurs-when-initializing-t.pat
Patch6013: backport-Change-length-variables-in-pcre2grep-from-int-to-siz.patch
Patch6014: backport-Add-an-ifdef-to-avoid-the-need-even-to-link-with-pcr.patch
Patch6015: backport-Fixed-an-issue-in-the-backtracking-optimization-of-c.patch
Patch6016: backport-jit-fail-early-in-ffcps_-if-subject-shorter-than-off.patch
Patch6017: 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
@ -130,6 +132,9 @@ make check
%{_pkgdocdir}/html/
%changelog
* Thu Mar 16 2023 yangmingtai <yangmingtai@huawei.com> - 10.40-3
- DESC:sync community patches
* Sat Nov 26 2022 huyubiao <huyubiao@huawei.com> - 10.40-2
- Update the Source0 URL.