From 59146bcde9aa2d2b8966dde296a3c2c2489ef209 Mon Sep 17 00:00:00 2001 From: yangmingtai Date: Mon, 31 Jul 2023 19:37:36 +0800 Subject: [PATCH] fix CVE-2022-41409 --- backport-fix-CVE-2022-41409.patch | 59 +++++++++++++++++++++++++++++++ pcre2.spec | 6 +++- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 backport-fix-CVE-2022-41409.patch diff --git a/backport-fix-CVE-2022-41409.patch b/backport-fix-CVE-2022-41409.patch new file mode 100644 index 0000000..e7bec77 --- /dev/null +++ b/backport-fix-CVE-2022-41409.patch @@ -0,0 +1,59 @@ +From 94e1c001761373b7d9450768aa15d04c25547a35 Mon Sep 17 00:00:00 2001 +From: Philip Hazel +Date: Tue, 16 Aug 2022 17:00:45 +0100 +Subject: [PATCH] Diagnose negative repeat value in pcre2test subject line + +Conflict:delete ChangeLog +Reference:https://github.com/PCRE2Project/pcre2/commit/94e1c001761373b7d9450768aa15d04c25547a35 +--- + src/pcre2test.c | 4 ++-- + testdata/testinput2 | 3 +++ + testdata/testoutput2 | 4 ++++ + 3 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/src/pcre2test.c b/src/pcre2test.c +index 11ec3ca..526aba8 100644 +--- a/src/pcre2test.c ++++ b/src/pcre2test.c +@@ -6766,9 +6766,9 @@ while ((c = *p++) != 0) + } + + i = (int32_t)li; +- if (i-- == 0) ++ if (i-- <= 0) + { +- fprintf(outfile, "** Zero repeat not allowed\n"); ++ fprintf(outfile, "** Zero or negative repeat not allowed\n"); + return PR_OK; + } + +diff --git a/testdata/testinput2 b/testdata/testinput2 +index 731a64a..2bce985 100644 +--- a/testdata/testinput2 ++++ b/testdata/testinput2 +@@ -5902,4 +5902,7 @@ a)"xI + + # --------- + ++-- ++ \[X]{-10} ++ + # End of testinput2 +diff --git a/testdata/testoutput2 b/testdata/testoutput2 +index 7479a0e..9acd5e6 100644 +--- a/testdata/testoutput2 ++++ b/testdata/testoutput2 +@@ -17674,6 +17674,10 @@ Failed: error 199 at offset 14: \K is not allowed in lookarounds (but see PCRE2_ + + # --------- + ++-- ++ \[X]{-10} ++** Zero or negative repeat not allowed ++ + # End of testinput2 + Error -70: PCRE2_ERROR_BADDATA (unknown error number) + Error -62: bad serialized data +-- +2.27.0 + diff --git a/pcre2.spec b/pcre2.spec index 62a9229..94a3fbd 100644 --- a/pcre2.spec +++ b/pcre2.spec @@ -1,6 +1,6 @@ Name: pcre2 Version: 10.39 -Release: 8 +Release: 9 Summary: Perl Compatible Regular Expressions License: BSD URL: http://www.pcre.org/ @@ -29,6 +29,7 @@ Patch6018: backport-pcre2grep-document-better-possible-multiline-matchin.pat Patch6019: backport-no-partial-match-if-trailing-data-is-invalid-utf-238.patch Patch6020: backport-Fix-an-invalid-match-of-ascii-word-classes-when-inva.patch Patch6021: backport-fix-wrong-test.patch +Patch6022: backport-fix-CVE-2022-41409.patch BuildRequires: autoconf libtool automake coreutils gcc make readline-devel Obsoletes: pcre2-utf16 pcre2-utf32 pcre2-tools @@ -145,6 +146,9 @@ make check %{_pkgdocdir}/html/ %changelog +* Mon Jul 31 2023 yangmingtai - 10.39-9 +- DESC:fix CVE-2022-41409 + * Mon Jun 26 2023 yangmingtai - 10.39-8 - DESC:sync community patchs -- Gitee