From 06afc9ff34185d3162acd1b6ad53c4a0adcb3ad9 Mon Sep 17 00:00:00 2001 From: lixiaoyong1 Date: Tue, 7 May 2024 14:30:36 +0800 Subject: [PATCH] Fixing an issue using empty character sets in jit --- ...ue-using-empty-character-sets-in-jit.patch | 71 +++++++++++++++++++ pcre2.spec | 6 +- 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 backport-Fixing-an-issue-using-empty-character-sets-in-jit.patch diff --git a/backport-Fixing-an-issue-using-empty-character-sets-in-jit.patch b/backport-Fixing-an-issue-using-empty-character-sets-in-jit.patch new file mode 100644 index 0000000..ebde8f3 --- /dev/null +++ b/backport-Fixing-an-issue-using-empty-character-sets-in-jit.patch @@ -0,0 +1,71 @@ +From 110324f9cce59bf2712667568bb529fb9f32da8f Mon Sep 17 00:00:00 2001 +From: lixiaoyong1 +Date: Tue, 7 May 2024 14:24:12 +0800 +Subject: [PATCH] backport Fixing an issue using empty character sets in jit + +--- + src/pcre2_jit_compile.c | 23 ++++++++++++++++------- + src/pcre2_jit_test.c | 1 + + 2 files changed, 17 insertions(+), 7 deletions(-) + +diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c +index 0afd27c..9fefcd6 100644 +--- a/src/pcre2_jit_compile.c ++++ b/src/pcre2_jit_compile.c +@@ -6028,25 +6028,34 @@ if (max < 1) + /* Convert last_count to priority. */ + for (i = 0; i < max; i++) + { +- SLJIT_ASSERT(chars[i].count > 0 && chars[i].last_count <= chars[i].count); ++ SLJIT_ASSERT(chars[i].last_count <= chars[i].count); + +- if (chars[i].count == 1) ++ switch (chars[i].count) + { ++ case 0: ++ chars[i].count = 255; ++ chars[i].last_count = 0; ++ break; ++ ++ case 1: + chars[i].last_count = (chars[i].last_count == 1) ? 7 : 5; + /* Simplifies algorithms later. */ + chars[i].chars[1] = chars[i].chars[0]; +- } +- else if (chars[i].count == 2) +- { ++ break; ++ ++ case 2: + SLJIT_ASSERT(chars[i].chars[0] != chars[i].chars[1]); + + if (is_powerof2(chars[i].chars[0] ^ chars[i].chars[1])) + chars[i].last_count = (chars[i].last_count == 2) ? 6 : 4; + else + chars[i].last_count = (chars[i].last_count == 2) ? 3 : 2; +- } +- else ++ break; ++ ++ default: + chars[i].last_count = (chars[i].count == 255) ? 0 : 1; ++ break; ++ } + } + + #ifdef JIT_HAS_FAST_FORWARD_CHAR_PAIR_SIMD +diff --git a/src/pcre2_jit_test.c b/src/pcre2_jit_test.c +index 81c9582..3234a2f 100644 +--- a/src/pcre2_jit_test.c ++++ b/src/pcre2_jit_test.c +@@ -391,6 +391,7 @@ static struct regression_test_case regression_test_cases[] = { + { MU, A, 0, 0, "[\\x{10001}-\\x{10fffe}]+", "#\xc3\xa9\xe2\xb1\xa5\xf0\x90\x80\x80\xf0\x90\x80\x81\xf4\x8f\xbf\xbe\xf4\x8f\xbf\xbf" }, + { MU, A, 0, 0, "[^\\x{10001}-\\x{10fffe}]+", "\xf0\x90\x80\x81#\xc3\xa9\xe2\xb1\xa5\xf0\x90\x80\x80\xf4\x8f\xbf\xbf\xf4\x8f\xbf\xbe" }, + { CMU, A, 0, 0 | F_NOMATCH, "^[\\x{0100}-\\x{017f}]", " " }, ++ { M, A, 0, 0 | F_NOMATCH, "[^\\S\\W]{6}", "abcdefghijk" }, + + /* Unicode properties. */ + { MUP, A, 0, 0, "[1-5\xc3\xa9\\w]", "\xc3\xa1_" }, +-- +2.33.0 + diff --git a/pcre2.spec b/pcre2.spec index 9948077..166d052 100644 --- a/pcre2.spec +++ b/pcre2.spec @@ -1,6 +1,6 @@ Name: pcre2 Version: 10.42 -Release: 6 +Release: 7 Summary: Perl Compatible Regular Expressions License: BSD URL: http://www.pcre.org/ @@ -28,6 +28,7 @@ Patch6016: backport-Fix-accept-and-endanchored-interaction-in-JIT.patch Patch6017: backport-Fix-backreferences-with-unset-backref-and-non-greedy.patch Patch6018: backport-Sanity-checks-for-ctype-functions-342.patch Patch6019: backport-Fix-incorrect-class-character-matches-in-JIT.patch +Patch6020: backport-Fixing-an-issue-using-empty-character-sets-in-jit.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 +* Tue May 07 2024 lixiaoyong - 10.42-7 +- DESC:Fixing an issue using empty character sets in jit + * Wed Mar 06 2024 xujing - 10.42-6 - DESC:exclude ChangeLog to avoid x86_64 conflict with i686 -- Gitee