diff --git a/.gitignore b/.gitignore index d0e2aba..b2d8efc 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/pcre2-10.37.tar.bz2 +SOURCES/pcre2-10.40.tar.bz2 diff --git a/.pcre2.metadata b/.pcre2.metadata index d56092b..a6d1c32 100644 --- a/.pcre2.metadata +++ b/.pcre2.metadata @@ -1 +1 @@ -4fcf6e0b4426b341de40295d2aa70b850ee8748d SOURCES/pcre2-10.37.tar.bz2 +5a433f92b29083d0d8ccd4ec56e3afbe1fa09863 SOURCES/pcre2-10.40.tar.bz2 diff --git a/SOURCES/pcre2-10.37-Fix-CVE-2022-1586.patch b/SOURCES/pcre2-10.37-Fix-CVE-2022-1586.patch deleted file mode 100644 index df1551f..0000000 --- a/SOURCES/pcre2-10.37-Fix-CVE-2022-1586.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- pcre2-10.32/src/pcre2_jit_compile.c.old 2022-05-13 09:13:06.188574517 +0000 -+++ pcre2-10.32/src/pcre2_jit_compile.c 2022-05-13 09:27:57.189574517 +0000 -@@ -6494,7 +6494,7 @@ while (*cc != XCL_END) - { - SLJIT_ASSERT(*cc == XCL_PROP || *cc == XCL_NOTPROP); - cc++; -- if (*cc == PT_CLIST) -+ if (*cc == PT_CLIST && cc[-1] == XCL_PROP) - { - other_cases = PRIV(ucd_caseless_sets) + cc[1]; - while (*other_cases != NOTACHAR) -diff -up pcre2-10.37/src/pcre2_jit_test.c.old pcre2-10.37/src/pcre2_jit_test.c ---- pcre2-10.37/src/pcre2_jit_test.c.old 2022-05-19 06:24:53.159574517 +0000 -+++ pcre2-10.37/src/pcre2_jit_test.c 2022-05-19 06:25:36.945574517 +0000 -@@ -411,6 +411,7 @@ static struct regression_test_case regre - { MUP, A, 0, 0 | F_PROPERTY, "[\\P{L&}]{2}[^\xc2\x85-\xc2\x89\\p{Ll}\\p{Lu}]{2}", "\xc3\xa9\xe6\x92\xad.a\xe6\x92\xad|\xc2\x8a#" }, - { PCRE2_UCP, 0, 0, 0 | F_PROPERTY, "[a-b\\s]{2,5}[^a]", "AB baaa" }, - { MUP, 0, 0, 0 | F_NOMATCH, "[^\\p{Hangul}\\p{Z}]", " " }, -+ { CMUP, 0, 0, 0, "[^S]\\B", "\xe2\x80\x8a" }, - - /* Possible empty brackets. */ - { MU, A, 0, 0, "(?:|ab||bc|a)+d", "abcxabcabd" }, diff --git a/SOURCES/pcre2-10.37-Fix-CVE-2022-1587.patch b/SOURCES/pcre2-10.37-Fix-CVE-2022-1587.patch deleted file mode 100644 index 86516d0..0000000 --- a/SOURCES/pcre2-10.37-Fix-CVE-2022-1587.patch +++ /dev/null @@ -1,623 +0,0 @@ ---- pcre2-10.37/src/pcre2_jit_compile.c.old 2022-05-19 08:29:17.936574517 +0000 -+++ pcre2-10.37/src/pcre2_jit_compile.c 2022-05-19 09:01:50.201574517 +0000 -@@ -413,6 +413,9 @@ typedef struct compiler_common { - /* Locals used by fast fail optimization. */ - sljit_s32 early_fail_start_ptr; - sljit_s32 early_fail_end_ptr; -+ /* Variables used by recursive call generator. */ -+ sljit_s32 recurse_bitset_size; -+ uint8_t *recurse_bitset; - - /* Flipped and lower case tables. */ - const sljit_u8 *fcc; -@@ -2312,19 +2315,39 @@ for (i = 0; i < RECURSE_TMP_REG_COUNT; i - - #undef RECURSE_TMP_REG_COUNT - -+static BOOL recurse_check_bit(compiler_common *common, sljit_sw bit_index) -+{ -+uint8_t *byte; -+uint8_t mask; -+ -+SLJIT_ASSERT((bit_index & (sizeof(sljit_sw) - 1)) == 0); -+ -+bit_index >>= SLJIT_WORD_SHIFT; -+ -+mask = 1 << (bit_index & 0x7); -+byte = common->recurse_bitset + (bit_index >> 3); -+ -+if (*byte & mask) -+ return FALSE; -+ -+*byte |= mask; -+return TRUE; -+} -+ - static int get_recurse_data_length(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPTR ccend, - BOOL *needs_control_head, BOOL *has_quit, BOOL *has_accept) - { - int length = 1; --int size; -+int size, offset; - PCRE2_SPTR alternative; - BOOL quit_found = FALSE; - BOOL accept_found = FALSE; - BOOL setsom_found = FALSE; - BOOL setmark_found = FALSE; --BOOL capture_last_found = FALSE; - BOOL control_head_found = FALSE; - -+memset(common->recurse_bitset, 0, common->recurse_bitset_size); -+ - #if defined DEBUG_FORCE_CONTROL_HEAD && DEBUG_FORCE_CONTROL_HEAD - SLJIT_ASSERT(common->control_head_ptr != 0); - control_head_found = TRUE; -@@ -2347,15 +2370,17 @@ while (cc < ccend) - setsom_found = TRUE; - if (common->mark_ptr != 0) - setmark_found = TRUE; -- if (common->capture_last_ptr != 0) -- capture_last_found = TRUE; -+ if (common->capture_last_ptr != 0 && recurse_check_bit(common, common->capture_last_ptr)) -+ length++; - cc += 1 + LINK_SIZE; - break; - - case OP_KET: -- if (PRIVATE_DATA(cc) != 0) -+ offset = PRIVATE_DATA(cc); -+ if (offset != 0) - { -- length++; -+ if (recurse_check_bit(common, offset)) -+ length++; - SLJIT_ASSERT(PRIVATE_DATA(cc + 1) != 0); - cc += PRIVATE_DATA(cc + 1); - } -@@ -2374,39 +2399,55 @@ while (cc < ccend) - case OP_SBRA: - case OP_SBRAPOS: - case OP_SCOND: -- length++; - SLJIT_ASSERT(PRIVATE_DATA(cc) != 0); -+ if (recurse_check_bit(common, PRIVATE_DATA(cc))) -+ length++; - cc += 1 + LINK_SIZE; - break; - - case OP_CBRA: - case OP_SCBRA: -- length += 2; -- if (common->capture_last_ptr != 0) -- capture_last_found = TRUE; -- if (common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0) -+ offset = GET2(cc, 1 + LINK_SIZE); -+ if (recurse_check_bit(common, OVECTOR(offset << 1))) -+ { -+ SLJIT_ASSERT(recurse_check_bit(common, OVECTOR((offset << 1) + 1))); -+ length += 2; -+ } -+ if (common->optimized_cbracket[offset] == 0 && recurse_check_bit(common, OVECTOR_PRIV(offset))) -+ length++; -+ if (common->capture_last_ptr != 0 && recurse_check_bit(common, common->capture_last_ptr)) - length++; - cc += 1 + LINK_SIZE + IMM2_SIZE; - break; - - case OP_CBRAPOS: - case OP_SCBRAPOS: -- length += 2 + 2; -- if (common->capture_last_ptr != 0) -- capture_last_found = TRUE; -+ offset = GET2(cc, 1 + LINK_SIZE); -+ if (recurse_check_bit(common, OVECTOR(offset << 1))) -+ { -+ SLJIT_ASSERT(recurse_check_bit(common, OVECTOR((offset << 1) + 1))); -+ length += 2; -+ } -+ if (recurse_check_bit(common, OVECTOR_PRIV(offset))) -+ length++; -+ if (recurse_check_bit(common, PRIVATE_DATA(cc))) -+ length++; -+ if (common->capture_last_ptr != 0 && recurse_check_bit(common, common->capture_last_ptr)) -+ length++; - cc += 1 + LINK_SIZE + IMM2_SIZE; - break; - - case OP_COND: - /* Might be a hidden SCOND. */ - alternative = cc + GET(cc, 1); -- if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN) -+ if ((*alternative == OP_KETRMAX || *alternative == OP_KETRMIN) && recurse_check_bit(common, PRIVATE_DATA(cc))) - length++; - cc += 1 + LINK_SIZE; - break; - - CASE_ITERATOR_PRIVATE_DATA_1 -- if (PRIVATE_DATA(cc) != 0) -+ offset = PRIVATE_DATA(cc); -+ if (offset != 0 && recurse_check_bit(common, offset)) - length++; - cc += 2; - #ifdef SUPPORT_UNICODE -@@ -2415,8 +2456,12 @@ while (cc < ccend) - break; - - CASE_ITERATOR_PRIVATE_DATA_2A -- if (PRIVATE_DATA(cc) != 0) -+ offset = PRIVATE_DATA(cc); -+ if (offset != 0 && recurse_check_bit(common, offset)) -+ { -+ SLJIT_ASSERT(recurse_check_bit(common, offset + sizeof(sljit_sw))); - length += 2; -+ } - cc += 2; - #ifdef SUPPORT_UNICODE - if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]); -@@ -2424,8 +2469,12 @@ while (cc < ccend) - break; - - CASE_ITERATOR_PRIVATE_DATA_2B -- if (PRIVATE_DATA(cc) != 0) -+ offset = PRIVATE_DATA(cc); -+ if (offset != 0 && recurse_check_bit(common, offset)) -+ { -+ SLJIT_ASSERT(recurse_check_bit(common, offset + sizeof(sljit_sw))); - length += 2; -+ } - cc += 2 + IMM2_SIZE; - #ifdef SUPPORT_UNICODE - if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]); -@@ -2433,20 +2482,29 @@ while (cc < ccend) - break; - - CASE_ITERATOR_TYPE_PRIVATE_DATA_1 -- if (PRIVATE_DATA(cc) != 0) -+ offset = PRIVATE_DATA(cc); -+ if (offset != 0 && recurse_check_bit(common, offset)) - length++; - cc += 1; - break; - - CASE_ITERATOR_TYPE_PRIVATE_DATA_2A -- if (PRIVATE_DATA(cc) != 0) -+ offset = PRIVATE_DATA(cc); -+ if (offset != 0 && recurse_check_bit(common, offset)) -+ { -+ SLJIT_ASSERT(recurse_check_bit(common, offset + sizeof(sljit_sw))); - length += 2; -+ } - cc += 1; - break; - - CASE_ITERATOR_TYPE_PRIVATE_DATA_2B -- if (PRIVATE_DATA(cc) != 0) -+ offset = PRIVATE_DATA(cc); -+ if (offset != 0 && recurse_check_bit(common, offset)) -+ { -+ SLJIT_ASSERT(recurse_check_bit(common, offset + sizeof(sljit_sw))); - length += 2; -+ } - cc += 1 + IMM2_SIZE; - break; - -@@ -2458,7 +2516,9 @@ while (cc < ccend) - #else - size = 1 + 32 / (int)sizeof(PCRE2_UCHAR); - #endif -- if (PRIVATE_DATA(cc) != 0) -+ -+ offset = PRIVATE_DATA(cc); -+ if (offset != 0 && recurse_check_bit(common, offset)) - length += get_class_iterator_size(cc + size); - cc += size; - break; -@@ -2493,8 +2553,7 @@ while (cc < ccend) - case OP_THEN: - SLJIT_ASSERT(common->control_head_ptr != 0); - quit_found = TRUE; -- if (!control_head_found) -- control_head_found = TRUE; -+ control_head_found = TRUE; - cc++; - break; - -@@ -2514,8 +2573,6 @@ SLJIT_ASSERT(cc == ccend); - - if (control_head_found) - length++; --if (capture_last_found) -- length++; - if (quit_found) - { - if (setsom_found) -@@ -2548,14 +2605,11 @@ sljit_sw shared_srcw[3]; - sljit_sw kept_shared_srcw[2]; - int private_count, shared_count, kept_shared_count; - int from_sp, base_reg, offset, i; --BOOL setsom_found = FALSE; --BOOL setmark_found = FALSE; --BOOL capture_last_found = FALSE; --BOOL control_head_found = FALSE; - -+memset(common->recurse_bitset, 0, common->recurse_bitset_size); - #if defined DEBUG_FORCE_CONTROL_HEAD && DEBUG_FORCE_CONTROL_HEAD - SLJIT_ASSERT(common->control_head_ptr != 0); --control_head_found = TRUE; -+recurse_check_bit(common, common->control_head_ptr); - #endif - - switch (type) -@@ -2643,11 +2697,10 @@ while (cc < ccend) - { - case OP_SET_SOM: - SLJIT_ASSERT(common->has_set_som); -- if (has_quit && !setsom_found) -+ if (has_quit && recurse_check_bit(common, OVECTOR(0))) - { - kept_shared_srcw[0] = OVECTOR(0); - kept_shared_count = 1; -- setsom_found = TRUE; - } - cc += 1; - break; -@@ -2655,33 +2708,31 @@ while (cc < ccend) - case OP_RECURSE: - if (has_quit) - { -- if (common->has_set_som && !setsom_found) -+ if (common->has_set_som && recurse_check_bit(common, OVECTOR(0))) - { - kept_shared_srcw[0] = OVECTOR(0); - kept_shared_count = 1; -- setsom_found = TRUE; - } -- if (common->mark_ptr != 0 && !setmark_found) -+ if (common->mark_ptr != 0 && recurse_check_bit(common, common->mark_ptr)) - { - kept_shared_srcw[kept_shared_count] = common->mark_ptr; - kept_shared_count++; -- setmark_found = TRUE; - } - } -- if (common->capture_last_ptr != 0 && !capture_last_found) -+ if (common->capture_last_ptr != 0 && recurse_check_bit(common, common->capture_last_ptr)) - { - shared_srcw[0] = common->capture_last_ptr; - shared_count = 1; -- capture_last_found = TRUE; - } - cc += 1 + LINK_SIZE; - break; - - case OP_KET: -- if (PRIVATE_DATA(cc) != 0) -+ private_srcw[0] = PRIVATE_DATA(cc); -+ if (private_srcw[0] != 0) - { -- private_count = 1; -- private_srcw[0] = PRIVATE_DATA(cc); -+ if (recurse_check_bit(common, private_srcw[0])) -+ private_count = 1; - SLJIT_ASSERT(PRIVATE_DATA(cc + 1) != 0); - cc += PRIVATE_DATA(cc + 1); - } -@@ -2700,50 +2751,66 @@ while (cc < ccend) - case OP_SBRA: - case OP_SBRAPOS: - case OP_SCOND: -- private_count = 1; - private_srcw[0] = PRIVATE_DATA(cc); -+ if (recurse_check_bit(common, private_srcw[0])) -+ private_count = 1; - cc += 1 + LINK_SIZE; - break; - - case OP_CBRA: - case OP_SCBRA: -- offset = (GET2(cc, 1 + LINK_SIZE)) << 1; -- shared_srcw[0] = OVECTOR(offset); -- shared_srcw[1] = OVECTOR(offset + 1); -- shared_count = 2; -+ offset = GET2(cc, 1 + LINK_SIZE); -+ shared_srcw[0] = OVECTOR(offset << 1); -+ if (recurse_check_bit(common, shared_srcw[0])) -+ { -+ shared_srcw[1] = shared_srcw[0] + sizeof(sljit_sw); -+ SLJIT_ASSERT(recurse_check_bit(common, shared_srcw[1])); -+ shared_count = 2; -+ } - -- if (common->capture_last_ptr != 0 && !capture_last_found) -+ if (common->capture_last_ptr != 0 && recurse_check_bit(common, common->capture_last_ptr)) - { -- shared_srcw[2] = common->capture_last_ptr; -- shared_count = 3; -- capture_last_found = TRUE; -+ shared_srcw[shared_count] = common->capture_last_ptr; -+ shared_count++; - } - -- if (common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0) -+ if (common->optimized_cbracket[offset] == 0) - { -- private_count = 1; -- private_srcw[0] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE)); -+ private_srcw[0] = OVECTOR_PRIV(offset); -+ if (recurse_check_bit(common, private_srcw[0])) -+ private_count = 1; - } -+ - cc += 1 + LINK_SIZE + IMM2_SIZE; - break; - - case OP_CBRAPOS: - case OP_SCBRAPOS: -- offset = (GET2(cc, 1 + LINK_SIZE)) << 1; -- shared_srcw[0] = OVECTOR(offset); -- shared_srcw[1] = OVECTOR(offset + 1); -- shared_count = 2; -+ offset = GET2(cc, 1 + LINK_SIZE); -+ shared_srcw[0] = OVECTOR(offset << 1); -+ if (recurse_check_bit(common, shared_srcw[0])) -+ { -+ shared_srcw[1] = shared_srcw[0] + sizeof(sljit_sw); -+ SLJIT_ASSERT(recurse_check_bit(common, shared_srcw[1])); -+ shared_count = 2; -+ } - -- if (common->capture_last_ptr != 0 && !capture_last_found) -+ if (common->capture_last_ptr != 0 && recurse_check_bit(common, common->capture_last_ptr)) - { -- shared_srcw[2] = common->capture_last_ptr; -- shared_count = 3; -- capture_last_found = TRUE; -+ shared_srcw[shared_count] = common->capture_last_ptr; -+ shared_count++; - } - -- private_count = 2; - private_srcw[0] = PRIVATE_DATA(cc); -- private_srcw[1] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE)); -+ if (recurse_check_bit(common, private_srcw[0])) -+ private_count = 1; -+ -+ offset = OVECTOR_PRIV(offset); -+ if (recurse_check_bit(common, offset)) -+ { -+ private_srcw[private_count] = offset; -+ private_count++; -+ } - cc += 1 + LINK_SIZE + IMM2_SIZE; - break; - -@@ -2752,18 +2819,17 @@ while (cc < ccend) - alternative = cc + GET(cc, 1); - if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN) - { -- private_count = 1; - private_srcw[0] = PRIVATE_DATA(cc); -+ if (recurse_check_bit(common, private_srcw[0])) -+ private_count = 1; - } - cc += 1 + LINK_SIZE; - break; - - CASE_ITERATOR_PRIVATE_DATA_1 -- if (PRIVATE_DATA(cc)) -- { -+ private_srcw[0] = PRIVATE_DATA(cc); -+ if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0])) - private_count = 1; -- private_srcw[0] = PRIVATE_DATA(cc); -- } - cc += 2; - #ifdef SUPPORT_UNICODE - if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]); -@@ -2771,11 +2837,12 @@ while (cc < ccend) - break; - - CASE_ITERATOR_PRIVATE_DATA_2A -- if (PRIVATE_DATA(cc)) -+ private_srcw[0] = PRIVATE_DATA(cc); -+ if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0])) - { - private_count = 2; -- private_srcw[0] = PRIVATE_DATA(cc); -- private_srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_sw); -+ private_srcw[1] = private_srcw[0] + sizeof(sljit_sw); -+ SLJIT_ASSERT(recurse_check_bit(common, private_srcw[1])); - } - cc += 2; - #ifdef SUPPORT_UNICODE -@@ -2784,11 +2851,12 @@ while (cc < ccend) - break; - - CASE_ITERATOR_PRIVATE_DATA_2B -- if (PRIVATE_DATA(cc)) -+ private_srcw[0] = PRIVATE_DATA(cc); -+ if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0])) - { - private_count = 2; -- private_srcw[0] = PRIVATE_DATA(cc); -- private_srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_sw); -+ private_srcw[1] = private_srcw[0] + sizeof(sljit_sw); -+ SLJIT_ASSERT(recurse_check_bit(common, private_srcw[1])); - } - cc += 2 + IMM2_SIZE; - #ifdef SUPPORT_UNICODE -@@ -2797,30 +2865,30 @@ while (cc < ccend) - break; - - CASE_ITERATOR_TYPE_PRIVATE_DATA_1 -- if (PRIVATE_DATA(cc)) -- { -+ private_srcw[0] = PRIVATE_DATA(cc); -+ if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0])) - private_count = 1; -- private_srcw[0] = PRIVATE_DATA(cc); -- } - cc += 1; - break; - - CASE_ITERATOR_TYPE_PRIVATE_DATA_2A -- if (PRIVATE_DATA(cc)) -+ private_srcw[0] = PRIVATE_DATA(cc); -+ if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0])) - { - private_count = 2; -- private_srcw[0] = PRIVATE_DATA(cc); - private_srcw[1] = private_srcw[0] + sizeof(sljit_sw); -+ SLJIT_ASSERT(recurse_check_bit(common, private_srcw[1])); - } - cc += 1; - break; - - CASE_ITERATOR_TYPE_PRIVATE_DATA_2B -- if (PRIVATE_DATA(cc)) -+ private_srcw[0] = PRIVATE_DATA(cc); -+ if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0])) - { - private_count = 2; -- private_srcw[0] = PRIVATE_DATA(cc); - private_srcw[1] = private_srcw[0] + sizeof(sljit_sw); -+ SLJIT_ASSERT(recurse_check_bit(common, private_srcw[1])); - } - cc += 1 + IMM2_SIZE; - break; -@@ -2837,14 +2905,17 @@ while (cc < ccend) - switch(get_class_iterator_size(cc + i)) - { - case 1: -- private_count = 1; - private_srcw[0] = PRIVATE_DATA(cc); - break; - - case 2: -- private_count = 2; - private_srcw[0] = PRIVATE_DATA(cc); -- private_srcw[1] = private_srcw[0] + sizeof(sljit_sw); -+ if (recurse_check_bit(common, private_srcw[0])) -+ { -+ private_count = 2; -+ private_srcw[1] = private_srcw[0] + sizeof(sljit_sw); -+ SLJIT_ASSERT(recurse_check_bit(common, private_srcw[1])); -+ } - break; - - default: -@@ -2859,28 +2930,25 @@ while (cc < ccend) - case OP_PRUNE_ARG: - case OP_THEN_ARG: - SLJIT_ASSERT(common->mark_ptr != 0); -- if (has_quit && !setmark_found) -+ if (has_quit && recurse_check_bit(common, common->mark_ptr)) - { - kept_shared_srcw[0] = common->mark_ptr; - kept_shared_count = 1; -- setmark_found = TRUE; - } -- if (common->control_head_ptr != 0 && !control_head_found) -+ if (common->control_head_ptr != 0 && recurse_check_bit(common, common->control_head_ptr)) - { - private_srcw[0] = common->control_head_ptr; - private_count = 1; -- control_head_found = TRUE; - } - cc += 1 + 2 + cc[1]; - break; - - case OP_THEN: - SLJIT_ASSERT(common->control_head_ptr != 0); -- if (!control_head_found) -+ if (recurse_check_bit(common, common->control_head_ptr)) - { - private_srcw[0] = common->control_head_ptr; - private_count = 1; -- control_head_found = TRUE; - } - cc++; - break; -@@ -2888,7 +2956,7 @@ while (cc < ccend) - default: - cc = next_opcode(common, cc); - SLJIT_ASSERT(cc != NULL); -- break; -+ continue; - } - - if (type != recurse_copy_shared_to_global && type != recurse_copy_kept_shared_to_global) -@@ -13648,7 +13716,7 @@ SLJIT_ASSERT(!(common->req_char_ptr != 0 - common->cbra_ptr = OVECTOR_START + (re->top_bracket + 1) * 2 * sizeof(sljit_sw); - - total_length = ccend - common->start; --common->private_data_ptrs = (sljit_s32 *)SLJIT_MALLOC(total_length * (sizeof(sljit_s32) + (common->has_then ? 1 : 0)), allocator_data); -+common->private_data_ptrs = (sljit_s32*)SLJIT_MALLOC(total_length * (sizeof(sljit_s32) + (common->has_then ? 1 : 0)), allocator_data); - if (!common->private_data_ptrs) - { - SLJIT_FREE(common->optimized_cbracket, allocator_data); -@@ -13689,6 +13757,7 @@ if (!compiler) - common->compiler = compiler; - - /* Main pcre_jit_exec entry. */ -+SLJIT_ASSERT((private_data_size & (sizeof(sljit_sw) - 1)) == 0); - sljit_emit_enter(compiler, 0, SLJIT_ARG1(SW), 5, 5, 0, 0, private_data_size); - - /* Register init. */ -@@ -13911,20 +13980,40 @@ common->early_fail_end_ptr = 0; - common->currententry = common->entries; - common->local_quit_available = TRUE; - quit_label = common->quit_label; --while (common->currententry != NULL) -+if (common->currententry != NULL) - { -- /* Might add new entries. */ -- compile_recurse(common); -- if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler))) -+ /* A free bit for each private data. */ -+ common->recurse_bitset_size = ((private_data_size / (int)sizeof(sljit_sw)) + 7) >> 3; -+ SLJIT_ASSERT(common->recurse_bitset_size > 0); -+ common->recurse_bitset = (sljit_u8*)SLJIT_MALLOC(common->recurse_bitset_size, allocator_data);; -+ -+ if (common->recurse_bitset != NULL) - { -+ do -+ { -+ /* Might add new entries. */ -+ compile_recurse(common); -+ if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler))) -+ break; -+ flush_stubs(common); -+ common->currententry = common->currententry->next; -+ } -+ while (common->currententry != NULL); -+ -+ SLJIT_FREE(common->recurse_bitset, allocator_data); -+ } -+ -+ if (common->currententry != NULL) -+ { -+ /* The common->recurse_bitset has been freed. */ -+ SLJIT_ASSERT(sljit_get_compiler_error(compiler) || common->recurse_bitset == NULL); -+ - sljit_free_compiler(compiler); - SLJIT_FREE(common->optimized_cbracket, allocator_data); - SLJIT_FREE(common->private_data_ptrs, allocator_data); - PRIV(jit_free_rodata)(common->read_only_data_head, allocator_data); - return PCRE2_ERROR_NOMEMORY; - } -- flush_stubs(common); -- common->currententry = common->currententry->next; - } - common->local_quit_available = FALSE; - common->quit_label = quit_label; ---- pcre2-10.37/src/pcre2_jit_test.c.old 2022-05-19 08:29:48.079574517 +0000 -+++ pcre2-10.37/src/pcre2_jit_test.c 2022-05-19 08:30:23.145574517 +0000 -@@ -747,6 +747,7 @@ static struct regression_test_case regre - { MU, A, 0, 0, "((?(R)a|(?1)){1,3}?)M", "aaaM" }, - { MU, A, 0, 0, "((.)(?:.|\\2(?1))){0}#(?1)#", "#aabbccdde# #aabbccddee#" }, - { MU, A, 0, 0, "((.)(?:\\2|\\2{4}b)){0}#(?:(?1))+#", "#aaaab# #aaaaab#" }, -+ { MU, A, 0, 0 | F_NOMATCH, "(?1)$((.|\\2xx){1,2})", "abc" }, - - /* 16 bit specific tests. */ - { CM, A, 0, 0 | F_FORCECONV, "\xc3\xa1", "\xc3\x81\xc3\xa1" }, diff --git a/SOURCES/pcre2-10.37-Fix-invalid-single-character-repetition-issues-in-JI.patch b/SOURCES/pcre2-10.37-Fix-invalid-single-character-repetition-issues-in-JI.patch deleted file mode 100644 index f84d577..0000000 --- a/SOURCES/pcre2-10.37-Fix-invalid-single-character-repetition-issues-in-JI.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 68b518ae703afcc672071e2bf65e4600bb2f2bfb Mon Sep 17 00:00:00 2001 -From: zherczeg -Date: Fri, 4 Jun 2021 12:55:49 +0000 -Subject: [PATCH] Fix invalid single character repetition issues in JIT. - -git-svn-id: svn://vcs.pcre.org/pcre2/code/trunk@1315 6239d852-aaf2-0410-a92c-79f79f948069 ---- - src/pcre2_jit_compile.c | 10 ++++++---- - src/pcre2_jit_test.c | 1 + - -diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c -index ae0d9a9..a3f7ebe 100644 ---- a/src/pcre2_jit_compile.c -+++ b/src/pcre2_jit_compile.c -@@ -1236,15 +1236,16 @@ start: - - return: current number of iterators enhanced with fast fail - */ --static int detect_early_fail(compiler_common *common, PCRE2_SPTR cc, int *private_data_start, sljit_s32 depth, int start) -+static int detect_early_fail(compiler_common *common, PCRE2_SPTR cc, int *private_data_start, -+ sljit_s32 depth, int start, BOOL fast_forward_allowed) - { - PCRE2_SPTR begin = cc; - PCRE2_SPTR next_alt; - PCRE2_SPTR end; - PCRE2_SPTR accelerated_start; -+BOOL prev_fast_forward_allowed; - int result = 0; - int count; --BOOL fast_forward_allowed = TRUE; - - SLJIT_ASSERT(*cc == OP_ONCE || *cc == OP_BRA || *cc == OP_CBRA); - SLJIT_ASSERT(*cc != OP_CBRA || common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] != 0); -@@ -1476,6 +1477,7 @@ do - case OP_CBRA: - end = cc + GET(cc, 1); - -+ prev_fast_forward_allowed = fast_forward_allowed; - fast_forward_allowed = FALSE; - if (depth >= 4) - break; -@@ -1484,7 +1486,7 @@ do - if (*end != OP_KET || (*cc == OP_CBRA && common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0)) - break; - -- count = detect_early_fail(common, cc, private_data_start, depth + 1, count); -+ count = detect_early_fail(common, cc, private_data_start, depth + 1, count, prev_fast_forward_allowed); - - if (PRIVATE_DATA(cc) != 0) - common->private_data_ptrs[begin - common->start] = 1; -@@ -13657,7 +13659,7 @@ memset(common->private_data_ptrs, 0, total_length * sizeof(sljit_s32)); - private_data_size = common->cbra_ptr + (re->top_bracket + 1) * sizeof(sljit_sw); - - if ((re->overall_options & PCRE2_ANCHORED) == 0 && (re->overall_options & PCRE2_NO_START_OPTIMIZE) == 0 && !common->has_skip_in_assert_back) -- detect_early_fail(common, common->start, &private_data_size, 0, 0); -+ detect_early_fail(common, common->start, &private_data_size, 0, 0, TRUE); - - set_private_data_ptrs(common, &private_data_size, ccend); - -diff --git a/src/pcre2_jit_test.c b/src/pcre2_jit_test.c -index d935887..f748016 100644 ---- a/src/pcre2_jit_test.c -+++ b/src/pcre2_jit_test.c -@@ -351,6 +351,7 @@ static struct regression_test_case regression_test_cases[] = { - { MU, A, 0, 0, ".[ab]*a", "xxa" }, - { MU, A, 0, 0, ".[ab]?.", "xx" }, - { MU, A, 0, 0, "_[ab]+_*a", "_aa" }, -+ { MU, A, 0, 0, "#(A+)#\\d+", "#A#A#0" }, - - /* Bracket repeats with limit. */ - { MU, A, 0, 0, "(?:(ab){2}){5}M", "abababababababababababM" }, --- -2.31.1 - diff --git a/SOURCES/pcre2-10.37.tar.bz2.sig b/SOURCES/pcre2-10.37.tar.bz2.sig deleted file mode 100644 index 7812ae6..0000000 Binary files a/SOURCES/pcre2-10.37.tar.bz2.sig and /dev/null differ diff --git a/SOURCES/pcre2-10.40.tar.bz2.sig b/SOURCES/pcre2-10.40.tar.bz2.sig new file mode 100644 index 0000000..2e5d3e4 Binary files /dev/null and b/SOURCES/pcre2-10.40.tar.bz2.sig differ diff --git a/SPECS/pcre2.spec b/SPECS/pcre2.spec index 37f9a00..7a669d0 100644 --- a/SPECS/pcre2.spec +++ b/SPECS/pcre2.spec @@ -8,8 +8,8 @@ # This is stable release: #%%global rcversion RC1 Name: pcre2 -Version: 10.37 -Release: %{?rcversion:0.}5%{?rcversion:.%rcversion}%{?dist} +Version: 10.40 +Release: %{?rcversion:0.}2%{?rcversion:.%rcversion}%{?dist} %global myversion %{version}%{?rcversion:-%rcversion} Summary: Perl-compatible regular expression library # the library: BSD with exceptions @@ -52,19 +52,6 @@ Source2: https://ftp.pcre.org/pub/pcre/Public-Key # Do no set RPATH if libdir is not /usr/lib Patch0: pcre2-10.10-Fix-multilib.patch -# Upstream's patch (r1315 merged) https://bugs.exim.org/show_bug.cgi?id=2764 -# Fix invalid single character repetition in JIT -Patch1: pcre2-10.37-Fix-invalid-single-character-repetition-issues-in-JI.patch -# Fix CVE-2022-1586 (Out-of-bounds read in compile_xclass_matchingpath) -# Downstream patch backport -# Source: https://github.com/PCRE2Project/pcre2/commit/50a51cb7e67268e6ad417eb07c9de9bfea5cc55a -# https://github.com/PCRE2Project/pcre2/commit/d4fa336fbcc388f89095b184ba6d99422cfc676c -Patch2: pcre2-10.37-Fix-CVE-2022-1586.patch -# Fix CVE-2022-1587 (Out-of-bounds read in get_recurse_data_length) -# Downstream patch backport -# Source: https://github.com/PCRE2Project/pcre2/commit/03654e751e7f0700693526b67dfcadda6b42c9d0 -Patch3: pcre2-10.37-Fix-CVE-2022-1587.patch - BuildRequires: autoconf BuildRequires: automake BuildRequires: coreutils @@ -271,11 +258,19 @@ make %{?_smp_mflags} check VERBOSE=yes %{_mandir}/man1/pcre2test.* %changelog -* Wed May 25 2022 Lukas Javorsky - 10.37-5 +* Wed May 18 2022 Lukas Javorsky - 10.40-2 - Explicitly require uft subpackages in tools subpackage -* Thu May 19 2022 Lukas Javorsky - 10.37-4 -- Resolves: CVE-2022-1586 CVE-2022-1587 +* Fri May 13 2022 Lukas Javorsky - 10.40-1 +- Rebase to the 10.40 +- Resolves multiple Out-of-bounds read errors + +* Fri May 13 2022 Lukas Javorsky - 10.39-1 +- Rebase to the 10.39 + +* Fri May 13 2022 Lukas Javorsky - 10.38-1 +- Rebase to the 10.38 +- Patch 1 upstreamed * Mon Aug 09 2021 Mohan Boddu - 10.37-3.1 - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags